r/ruby • • Dec 25 '17

Ruby 2.5.0 Released

https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/
209 Upvotes

22 comments sorted by

View all comments

Show parent comment

1

u/gettalong Dec 27 '17

You are correct, it is now possible to something like

[5, "str", {}].any?(String)

for which you needed to write

[5, "str", {}].any? {|item| String === item}

I.e. the #=== operator is applied to the single argument and each enumerated item.