From: adamluzsi@... Date: 2016-03-26T01:22:24+00:00 Subject: [ruby-core:74584] [Ruby trunk Bug#12216] Class inherited Singleton method exclude argument from protected method accessing Issue #12216 has been updated by Adam Luzsi. Nobuyoshi Nakada wrote: > Expected behavior. > In the `inherited` method, `self` and `klass` are `A` and `B` respectively, which are instances of `Class`. > Protected methods can be called from a same class instance. Thank you very much! My mistake, I mixed up with the private scope. I'm terrible sorry for this. Best regards, Adam L. ---------------------------------------- Bug #12216: Class inherited Singleton method exclude argument from protected method accessing https://bugs.ruby-lang.org/issues/12216#change-57714 * Author: Adam Luzsi * Status: Rejected * Priority: Normal * Assignee: * ruby -v: 1.8.7-p375 && 1.9 && 2.+ * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- 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! ```ruby 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" ``` -- https://bugs.ruby-lang.org/ Unsubscribe: