Project

General

Profile

Actions

Bug #12216

closed

Class inherited Singleton method exclude argument from protected method accessing

Added by adamluzsi (Adam Luzsi) about 8 years ago. Updated about 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.8.7-p375 && 1.9 && 2.+
[ruby-core:74542]

Description

Dear Ruby Lang developers.

I would like to ask about why the following code can work?

Or is it a valid scenario and "as expected" behavior to ignore public call on a protected method.

Thank you guys for the brilliant!

class A
  class << self
    def inherited(klass)
      p klass.protected_method_call
    end

    protected
    def protected_method_call
      self.to_s
    end
  end
end

class B < A
end

# output: "B"
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0