Created
February 23, 2015 21:04
-
-
Save tadman/f0adf6c99e08a4e6ee45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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