Skip to content

Instantly share code, notes, and snippets.

@fables-tales
Created September 4, 2013 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fables-tales/6436357 to your computer and use it in GitHub Desktop.
Save fables-tales/6436357 to your computer and use it in GitHub Desktop.
1.9.3p448 :002 > a = [-> { puts 1; true }, -> { puts 2; false}, -> { puts 3; false }]
=> [#<Proc:0x007fe5c41a8f68@(irb):2 (lambda)>, #<Proc:0x007fe5c41a8f18@(irb):2 (lambda)>, #<Proc:0x007fe5c41a8ef0@(irb):2 (lambda)>]
1.9.3p448 :003 > a.all?(&:call)
1
2
=> false
1.9.3p448 :004 > a = [-> { puts 1; false }, -> { puts 2; true}, -> { puts 3; false }]
=> [#<Proc:0x007fe5c4276620@(irb):4 (lambda)>, #<Proc:0x007fe5c42765d0@(irb):4 (lambda)>, #<Proc:0x007fe5c42765a8@(irb):4 (lambda)>]
1.9.3p448 :005 > a.any?(&:call)
1
2
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment