Class: Message
- Inherits:
-
Object
- Object
- Message
- Defined in:
- lib/ang_ttt_gem/message.rb
Instance Method Summary collapse
-
#initialize ⇒ Message
constructor
A new instance of Message.
- #passed(*keys) ⇒ Object
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ang_ttt_gem/message.rb', line 3 def initialize @message = { welcome: "Welcome to Tic Tac Toe! You will create 2 players. The first player you create will go first.", create_player: "Create a player.", determine_player_type: "Do you want the player to be human or computer? (human/computer)", select_player_mark: "Please select a single letter to represent the player.", invalid_selection: "That is an invalid selection, please make a valid selection.", select_square: "Please select an open square.", player_1_win: "Player 1 is the winner!", player_2_win: "Player 2 is the winner!", draw: "It's a draw.", play_again?: "Would you like to play again? (Y/N)", } end |
Instance Method Details
#passed(*keys) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ang_ttt_gem/message.rb', line 19 def passed(*keys) = String.new keys.each do |key| << @message[key] + "\n" end end |