Orion Edwards
2009-Nov-09 02:42 UTC
[Ironruby-core] IronRuby 0.9.2 bug - Can''t define a singleton method on a COM object instance
This code used to work under IronRuby 0.9.1 and earlier load_assembly "microsoft.office.word.interop" word = Microsoft::Office::Interop::Word::ApplicationClass.new metaclass = class << word; self; end metaclass.send :define_method, "fizz" do |*args| puts "hello" end #BANG! Under 0.9.2, this happens NoMethodError: private method `singleton_method_added'' called for Microsoft.Office.Interop.Word.ApplicationClass:Microsoft::Office::Interop::Word::ApplicationClass from (irb):52 from :0:in `define_method'' from :0:in `define_method'' from :0:in `send'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:146:in `eval_input'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:70:in `start'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:69:in `start'' from :0:in `eval'' from workspace.rb:80:in `evaluate'' from context.rb:217:in `evaluate'' from irb.rb:147:in `eval_input'' from irb.rb:257:in `signal_status'' from irb.rb:146:in `eval_input'' from ruby-lex.rb:230:in `each_top_level_statement'' from :0:in `loop'' from C:/Dev/TEST/ruby/bin/iirb:13 from :0:in `catch'' from :0:i While the previous bug (calling super from method_missing on a COM object) was easy to work around and isn''t that important in the scheme of things, this one is a real blocker :-( Might have to roll back to 0.9.1 :-( -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091109/b91ef05f/attachment.html>
Tomas Matousek
2009-Nov-11 19:47 UTC
[Ironruby-core] IronRuby 0.9.2 bug - Can''t define a singleton method on a COM object instance
You might be able to work this around by making singleton_method_added a public method. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Sunday, November 08, 2009 6:43 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] IronRuby 0.9.2 bug - Can''t define a singleton method on a COM object instance This code used to work under IronRuby 0.9.1 and earlier load_assembly "microsoft.office.word.interop" word = Microsoft::Office::Interop::Word::ApplicationClass.new metaclass = class << word; self; end metaclass.send :define_method, "fizz" do |*args| puts "hello" end #BANG! Under 0.9.2, this happens NoMethodError: private method `singleton_method_added'' called for Microsoft.Office.Interop.Word.ApplicationClass:Microsoft::Office::Interop::Word::ApplicationClass from (irb):52 from :0:in `define_method'' from :0:in `define_method'' from :0:in `send'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:146:in `eval_input'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:70:in `start'' from C:/Dev/TEST/ruby/lib/ruby/1.8/irb.rb:69:in `start'' from :0:in `eval'' from workspace.rb:80:in `evaluate'' from context.rb:217:in `evaluate'' from irb.rb:147:in `eval_input'' from irb.rb:257:in `signal_status'' from irb.rb:146:in `eval_input'' from ruby-lex.rb:230:in `each_top_level_statement'' from :0:in `loop'' from C:/Dev/TEST/ruby/bin/iirb:13 from :0:in `catch'' from :0:i While the previous bug (calling super from method_missing on a COM object) was easy to work around and isn''t that important in the scheme of things, this one is a real blocker :-( Might have to roll back to 0.9.1 :-( -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091111/94c72a66/attachment-0001.html>