Created
May 9, 2012 03:19
-
-
Save burtlo/2641529 to your computer and use it in GitHub Desktop.
modules
This file contains hidden or 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
module BeginState | |
def add_player | |
# really add the player | |
end | |
def add_ship | |
# really do it | |
end | |
def shoot | |
puts "You cannot shoot while we are setting up" | |
end | |
end | |
module PlayingState | |
def add_player | |
puts "You cannot add a player now that the game has started" | |
end | |
def add_ship | |
puts "Stop Cheating!" | |
end | |
def shoot | |
# actually do the shoot method | |
end | |
end | |
module EndGameState | |
def announce_game_is_over | |
puts "Start a new game" | |
end | |
alias_method :add_player, :announce_game_is_over | |
alias_method :add_ship, :announce_game_is_over | |
alias_method :shoot, :announce_game_is_over | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment