Bug #8127

NoMethodError for private / protected methods with Module#prepend

Added by Dmitriy Meremyanin about 1 year ago. Updated about 1 year ago.

[ruby-core:53555]
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] Backport:

Description

=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.respondto?(:protectedmethod, true) #=> true
record.send(:protectedmethod) #=> NoMethodError: undefined method `protectedmethod'
=end


Related issues

Duplicates Backport200 - Backport #8005: Methods made private/protected after definition are made ... Closed 03/02/2013

History

#1 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Open to Closed

Also available in: Atom PDF