Skip to content

Instantly share code, notes, and snippets.

@Sihui
Last active July 28, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sihui/9816babcd08ddee26ca13cd800828eb1 to your computer and use it in GitHub Desktop.
Save Sihui/9816babcd08ddee26ca13cd800828eb1 to your computer and use it in GitHub Desktop.
Design Pattern: Command and Hotel Service
class SpaReservationService
attr_reader :data, :spa_center
def initialize(data)
@data = data
@spa_center = SpaCenter.new
end
def execute
spa_center.reserve(data)
end
def undo
spa_center.cancel(data)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment