Forum: Ruby-core [ruby-trunk - Bug #8127][Open] NoMethodError for private / protected methods with Module#prepend

Posted by dimko (Dmitriy Meremyanin) (Guest)
on 2013-03-19 23:50
(Received via mailing list)
Issue #8127 has been reported by dimko (Dmitriy Meremyanin).

----------------------------------------
Bug #8127: NoMethodError for private / protected methods with 
Module#prepend
https://bugs.ruby-lang.org/issues/8127

Author: dimko (Dmitriy Meremyanin)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]


=begin
Calling protected / private methods after using Module#prepend raises 
NoMethodError exception.

 module Foo
 end

 class Record
   prepend Foo

   def protected_method
   end

   protected :protected_method
 end

 record = Record.new
 record.respond_to?(:protected_method, true)  #=> true
 record.send(:protected_method)               #=> NoMethodError: 
undefined method `protected_method'
=end
Posted by Nobuyoshi Nakada (nobu)
on 2013-03-20 00:31
(Received via mailing list)
Issue #8127 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Closed


----------------------------------------
Bug #8127: NoMethodError for private / protected methods with 
Module#prepend
https://bugs.ruby-lang.org/issues/8127#change-37746

Author: dimko (Dmitriy Meremyanin)
Status: Closed
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]


=begin
Calling protected / private methods after using Module#prepend raises 
NoMethodError exception.

 module Foo
 end

 class Record
   prepend Foo

   def protected_method
   end

   protected :protected_method
 end

 record = Record.new
 record.respond_to?(:protected_method, true)  #=> true
 record.send(:protected_method)               #=> NoMethodError: 
undefined method `protected_method'
=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.