Created
October 28, 2010 22:35
-
-
Save sgonyea/652485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (VALUE)toRuby { | |
switch ([self objCType]) { | |
case @encode(char): | |
case @encode(unsigned char): return CHR2FIX([self charValue]); break; | |
case @encode(short): | |
case @encode(long): | |
case @encode(int): return INT2FIX([self intValue]); break; | |
case @encode(unsigned short): | |
case @encode(unsigned long): | |
case @encode(unsigned int): return UINT2NUM([self unsignedIntValue]); break; | |
case @encode(unsigned float): | |
case @encode(float): return rb_float_new([self floatValue]); break; | |
case @encode(unsigned double): | |
case @encode(double): return rb_float_new([self doubleValue]); break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment