Project

General

Profile

Bug #8127

NoMethodError for private / protected methods with Module#prepend

Added by Dmitriy Meremyanin almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
ruby -v:
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]
Backport:
2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
[ruby-core:53555]

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


Related issues

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

History

#1 [ruby-core:53560] Updated by Nobuyoshi Nakada almost 3 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF