Ticket #709 (closed defect: duplicate)
Different behaviour when including a module into Class in MacRuby vs Ruby 1.9.2
| Reported by: | james@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | MacRuby | Keywords: | #reduction mocha class module include |
| Cc: | james@… |
Description
I'm seeing different behaviour when including a module into Class in MacRuby vs Ruby 1.9.2. This is a simplification of a problem I'm seeing running Mocha [1] tests in MacRuby. I seems to be specific to including the module into the Class class and not a user-defined class. It also doesn't seem to matter whether the class has already been defined or not.
$ rvm macruby $ irb macruby-0.6 > module X; def x; "x"; end; end => nil macruby-0.6 > class Class; include X; end => Class macruby-0.6 > Class.new.x NoMethodError: undefined method `x' for #<Class:0x20020f960> from /Users/jamesmead/Code/mocha/(irb):3:in `<main>'
$ rvm 1.9.2 $ irb ruby-1.9.2-preview1 > module X; def x; "x"; end; end => nil ruby-1.9.2-preview1 > class Class; include X; end => Class ruby-1.9.2-preview1 > Class.new.x => "x"
$ rvm macruby $ irb macruby-0.6 > module X; def x; "x"; end; end => nil macruby-0.6 > class Y; include X; end => Y macruby-0.6 > Y.new.x => "x"
$ rvm macruby $ irb macruby-0.6 > module X; def x; "x"; end; end => nil macruby-0.6 > class Y; end => nil macruby-0.6 > class Y; include X; end => Y macruby-0.6 > Y.new.x => "x"
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


