Is there a pretty way to make a series of method calls in ruby UNTIL one returns true?
This was my first thought, but was thinking there might be a nicer way:
if method_one
elsif method_two
elsif method_three
else
puts "none worked"
end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use Enumerable#any? as well.