From: "bjfish (Brandon Fish)" Date: 2022-06-13T20:43:17+00:00 Subject: [ruby-core:108882] [Ruby master Bug#18826] Symbol#to_proc inconsistent, sometimes calls private methods Issue #18826 has been reported by bjfish (Brandon Fish). ---------------------------------------- Bug #18826: Symbol#to_proc inconsistent, sometimes calls private methods https://bugs.ruby-lang.org/issues/18826 * Author: bjfish (Brandon Fish) * Status: Open * Priority: Normal * ruby -v: 3.0.3 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- The following usage calls a protected method and prints "hello": ``` ruby class Test protected def referenced_columns puts "hello" end end Test.new.tap(&:referenced_columns) ``` However, the following usage results in a NoMethodError: ``` ruby class Integer private def foo 42 end end (1..4).collect(&:foo) ``` It seems to be a bug that tap calls a private method. It is also inconsistent with collect not calling private methods. -- https://bugs.ruby-lang.org/ Unsubscribe: