Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class InformationDesk
include DeskTasks
end
class DoNotDisturb
include DeskTasks
def check_lunch_break
hour = Time.now.hour
raise "Out for lunch" if hour >= 12 && hour < 14
end
def emergency
"emergency() called"
end
end
# At 12:30...
DoNotDisturb.new.emergency # => "emergency() called"
DoNotDisturb.new.flights # ~> -:32:in `check_lunch_break': Out for lunch (RuntimeError)
module DeskTasks
def check_lunch_break
true # or a no-op, or whatever is useful here
end
def emergency
# Call emergency...
check_lunch_break
"emergency() called"
end
def flights
# Provide flight information...
check_lunch_break
"flights() called"
end
def local_transports
# Return a metro map...
check_lunch_break
"local_transports() called"
end
def hotels
# Find a suitable hotel...
check_lunch_break
"hotels() called"
end
# ...even more methods
end
@rubypond
Owner

No description provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.