ruby-changes:34937
From: suke <ko1@a...>
Date: Thu, 31 Jul 2014 22:23:09 +0900 (JST)
Subject: [ruby-changes:34937] suke:r47020 (trunk): * ext/win32ole/win32ole.c: add WIN32OLE_RECORD#inspect.
suke 2014-07-31 22:21:50 +0900 (Thu, 31 Jul 2014) New Revision: 47020 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47020 Log: * ext/win32ole/win32ole.c: add WIN32OLE_RECORD#inspect. Modified files: trunk/ChangeLog trunk/ext/win32ole/win32ole.c Index: ChangeLog =================================================================== --- ChangeLog (revision 47019) +++ ChangeLog (revision 47020) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jul 31 22:20:12 2014 Masaki Suketa <masaki.suketa@n...> + + * ext/win32ole/win32ole.c: add WIN32OLE_RECORD#inspect. + Thu Jul 31 20:35:32 2014 Masaki Suketa <masaki.suketa@n...> * ext/win32ole/win32ole.c: add Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 47019) +++ ext/win32ole/win32ole.c (revision 47020) @@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L143 #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "1.6.8" +#define WIN32OLE_VERSION "1.6.9" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -615,6 +615,7 @@ static VALUE olerecord_ivar_set(VALUE se https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L615 static VALUE folerecord_method_missing(int argc, VALUE *argv, VALUE self); static VALUE folerecord_ole_instance_variable_get(VALUE self, VALUE name); static VALUE folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val); +static VALUE folerecord_inspect(VALUE self); static void init_enc2cp(void); static void free_enc2cp(void); @@ -9651,6 +9652,21 @@ folerecord_ole_instance_variable_set(VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9652 return olerecord_ivar_set(self, sname, val); } +static VALUE +folerecord_inspect(VALUE self) +{ + VALUE tname; + VALUE field; + tname = folerecord_typename(self); + if (tname == Qnil) { + tname = rb_inspect(tname); + } + field = rb_inspect(folerecord_to_h(self)); + return rb_sprintf("#<WIN32OLE_RECORD(%s) %s>", + StringValuePtr(tname), + StringValuePtr(field)); +} + static void init_enc2cp(void) { @@ -9976,6 +9992,7 @@ Init_win32ole(void) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9992 rb_define_method(cWIN32OLE_RECORD, "method_missing", folerecord_method_missing, -1); rb_define_method(cWIN32OLE_RECORD, "ole_instance_variable_get", folerecord_ole_instance_variable_get, 1); rb_define_method(cWIN32OLE_RECORD, "ole_instance_variable_set", folerecord_ole_instance_variable_set, 2); + rb_define_method(cWIN32OLE_RECORD, "inspect", folerecord_inspect, 0); eWIN32OLERuntimeError = rb_define_class("WIN32OLERuntimeError", rb_eRuntimeError); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/