Created
February 19, 2018 20:53
-
-
Save bquorning/a8973da215ac810c21e3ac79bdce9726 to your computer and use it in GitHub Desktop.
Did Ruby 2.5 introduce a new bug, or fix an old bug? The implicit `flatten` -> `to_ary` -> `respond_to_missing` call has changed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def respond_to?(method, include_all = false) | |
::Kernel.puts "respond_to?(#{method.inspect}, #{include_all.inspect})" | |
end | |
end | |
class B | |
def respond_to_missing?(method, include_all = false) | |
::Kernel.puts "respond_to_missing?(#{method.inspect}, #{include_all.inspect})" | |
end | |
end | |
puts RUBY_VERSION | |
[A.new, B.new].flatten | |
# Output: | |
# | |
# 2.4.2 | |
# respond_to?(:to_ary, true) | |
# respond_to_missing?(:to_ary, false) | |
# | |
# 2.5.0 | |
# respond_to?(:to_ary, true) | |
# respond_to_missing?(:to_ary, true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment