Skip to content

Instantly share code, notes, and snippets.

@tadman
Created February 23, 2015 21:04
Show Gist options
  • Save tadman/f0adf6c99e08a4e6ee45 to your computer and use it in GitHub Desktop.
Save tadman/f0adf6c99e08a4e6ee45 to your computer and use it in GitHub Desktop.
def are_okay?(list)
list.all? do |i|
begin
# Arbitrary method call
i.floor
true
rescue
# Should rescue from known exception (or Pokemon capture)
false
end
end
end
list = [ 1, 2, 3, 4, 5 ]
puts are_okay?(list).inspect
list = [ 1, 2, :no, 4, 5 ]
puts are_okay?(list).inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment