Created
January 9, 2016 16:37
-
-
Save VelizarHristov/6a0a8bacabf68569e210 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 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 |
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
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