Skip to content

Instantly share code, notes, and snippets.

@tadman
Created February 23, 2015 21:04
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