Actions
Bug #15255
closedChange in protected handling 2.3 -> 2.4,2.5
Description
It looks like when moving to 2.4 and higher, the access to protected method has changed. In the following case:
class Foo
def bar(objects)
objects.map(&:baz)
end
protected
def baz
self.inspect
end
end
a = Foo.new; b = Foo.new
a.bar([b])
The protected method '...' called
will be raised. I haven't seen any explicit mention of this in the release notes.
It can be rewritten to successfully run as:
objects.map { |x| x.baz }
But it was an unexpected change. (so potentially a bug?)
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
- Status changed from Open to Rejected
Testing Ruby versions from 1.9 to 2.7, only Ruby 2.3 does not raise a NoMethodError
for the example code. I think that can be considered a bug in Ruby 2.3. As Ruby 2.3 is no longer supported, the bug will not be fixed.
Actions
Like0
Like0