Skip to content

Instantly share code, notes, and snippets.

@VelizarHristov
Created January 9, 2016 16:37
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
def state
if not collected?
'booked'
elsif not ironed?
'collected'
elsif not delivered?
'ironed'
else
'delivered'
end
end
# ironed? might raise an exception if collected? is false
# delivered? might raise an exception if ironed? is false
STATES = ['booked', 'collected', 'ironed', 'delivered']
def state
STATES[[collected?, ironed?, delivered?].take_while(&:itself).size]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment