[Ironruby-core] IronRuby 0.9.2 bug - Can't define a singleton method on a COM object instance

Orion Edwards orion.edwards at gmail.com
Sun Nov 8 21:42:54 EST 2009

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
        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>

More information about the Ironruby-core mailing list