Skip to content

Instantly share code, notes, and snippets.

@myabc
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myabc/24e71a74ef08185eaf6b to your computer and use it in GitHub Desktop.
Save myabc/24e71a74ef08185eaf6b to your computer and use it in GitHub Desktop.
arr = [:a, :b, :c]
def check_item(item)
item == :c
end
Object.class_eval do
alias ⅋ method
end
p arr.any?(&method(:check_item))
p arr.any? { |i| check_item(i) }
p arr.any?(&⅋(:check_item))
@plexus
Copy link

plexus commented Nov 29, 2014

How about

arr.any? &(:check_item)

?

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment