Issue #8005 has been reported by skwosh (Alex Goldsmith). ---------------------------------------- Bug #8005: Methods made private/protected after definition are made uncallable by prepend https://bugs.ruby-lang.org/issues/8005 Author: skwosh (Alex Goldsmith) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0] Prepending a module seems to break method resolution for methods that have been made `private` or `protected` via the `def private *names` and `def protected *names` methods. ___ class A end A.send :prepend, Module.new {} # Works if this line is removed... class A def foo() end protected :foo # Also works if we use the argument-less form of "protected"... end A.new.respond_to? :foo, true # => true A.new.send :foo # => NoMethodError: undefined method `foo' for #<A:...> ___ Note that it correctly reports that it can respond_to?... This breaks in Rails 4 when trying to prepend to an ActiveRecord::Base (due to dynamically defined model callbacks).
[ruby-trunk - Bug #8005][Open] Methods made private/protected after definition are made uncallable b
on 2013-03-02 15:15
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
Log in with Google account | Log in with Yahoo account
No account? Register here.