[MacRuby] #1245: alias_method not working in included module
#1245: alias_method not working in included module --------------------------------+------------------------------------------- Reporter: petr.kaleta@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Bug reduction: {{{ class Base module InstanceMethods alias_method :model, :class end end class Model include Base::InstanceMethods end class Item < Model end puts Item.new.model }}} Also available as gist https://gist.github.com/946712 Works perfectly in pure ruby 1.8.7 & 1.9.2 but not in macruby -- Ticket URL: <http://www.macruby.org/trac/ticket/1245> MacRuby <http://macruby.org/>
#1245: alias_method not working in included module --------------------------------+------------------------------------------- Reporter: petr.kaleta@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 0.11 => Comment: It works is a pure-Ruby method is being aliased. {{{ $ cat t4.rb module InstanceMethods def foo;42;end alias_method :model, :foo end class Model include InstanceMethods end puts Model.new.model $ ./miniruby t4.rb 42 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1245#comment:1> MacRuby <http://macruby.org/>
#1245: alias_method not working in included module --------------------------------+------------------------------------------- Reporter: petr.kaleta@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- Comment(by lsansonetti@…): This is by design, #include will not copy non-Ruby methods. #class here is a pure Objective-C method defined on NSObject. Is this bug breaking an existing gem/library? -- Ticket URL: <http://www.macruby.org/trac/ticket/1245#comment:2> MacRuby <http://macruby.org/>
#1245: alias_method not working in included module --------------------------------+------------------------------------------- Reporter: petr.kaleta@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | --------------------------------+------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: I changed #include to now also copy objc methods, and it seems that rubyspec is passing, so I committed the change: https://github.com/MacRuby/MacRuby/commit/d858b9d34141de0930d04cbfb6e70ef246... -- Ticket URL: <http://www.macruby.org/trac/ticket/1245#comment:3> MacRuby <http://macruby.org/>
#1245: alias_method not working in included module --------------------------------+------------------------------------------- Reporter: petr.kaleta@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | --------------------------------+------------------------------------------- Comment(by petr.kaleta@…): Replying to [comment:2 lsansonetti@…]:
This is by design, #include will not copy non-Ruby methods. #class here is a pure Objective-C method defined on NSObject.
Is this bug breaking an existing gem/library?
Yes, it is breaking for for example Sequel gem. -- Ticket URL: <http://www.macruby.org/trac/ticket/1245#comment:4> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby