// static public implicit operator bool ( R_VAL value ) { // switch ( RubyDLL.r_type ( value ) ) { // case rb_vtype.RUBY_T_FALSE: // // case rb_vtype.RUBY_T_EXCEPTION: // case rb_vtype.RUBY_T_UNDEF: // return false; // } // // return true; // } public string ToString() { var str = RubyDLL.rb_obj_as_string(this); int length = 0; IntPtr ptr = RubyDLL.r_string_value_cstr(ref str); unsafe { byte *p = ( byte * )ptr; while (*p != 0) { length++; p++; } } byte[] bytes = new byte[length]; Marshal.Copy(ptr, bytes, 0, length); return(RubyDLL.Encoding.GetString(bytes)); }