Last active
July 28, 2017 04:27
-
-
Save Sihui/9816babcd08ddee26ca13cd800828eb1 to your computer and use it in GitHub Desktop.
Design Pattern: Command and Hotel Service
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
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