[MacRuby] #982: Class#public_instance_methods keeps reporting methods after removing them

MacRuby ruby-noreply at macosforge.org
Thu Oct 28 01:20:49 PDT 2010


#982: Class#public_instance_methods keeps reporting methods after removing them
--------------------------------+-------------------------------------------
 Reporter:  manfred@…           |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  blocker             |   Milestone:                       
Component:  MacRuby             |    Keywords:                       
--------------------------------+-------------------------------------------
 When you remove a method from a class it's still reported by
 public_instance_methods afterwards. However instances don't respond to the
 method anymore.

 {{{
 class Foo
   def bar;end
 end
 Foo.send(:remove_method, :bar)
 p Foo.public_instance_methods(true).grep(/bar/)
 p Foo.new.respond_to?(:bar)
 p Foo.new.bar
 }}}

 In MacRuby nightly:

 {{{
 lsof% macruby t.rb
 [:bar]
 false
 /Users/manfred/Code/mocha/t.rb:7:in `<main>': undefined method `bar' for
 #<Foo:0x2000cef00> (NoMethodError)
 }}}

 On 1.9.2;

 {{{
 lsof% /opt/ruby-1.9.2/bin/ruby t.rb
 []
 false
 t.rb:7:in `<main>': undefined method `bar' for #<Foo:0x0000010086c878>
 (NoMethodError)
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/982>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list