Class: PaitinHangman::GameData
- Inherits:
-
Object
- Object
- PaitinHangman::GameData
- Defined in:
- lib/paitin_hangman/game_data.rb
Instance Attribute Summary collapse
-
#chances ⇒ Object
readonly
Returns the value of attribute chances.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#game_word ⇒ Object
readonly
Returns the value of attribute game_word.
-
#misses ⇒ Object
readonly
Returns the value of attribute misses.
-
#player_name ⇒ Object
readonly
Returns the value of attribute player_name.
-
#right_guesses ⇒ Object
readonly
Returns the value of attribute right_guesses.
-
#word_control ⇒ Object
readonly
Returns the value of attribute word_control.
Instance Method Summary collapse
-
#initialize(player_name, misses, right_guesses, chances, word_control, game_word, count) ⇒ GameData
constructor
A new instance of GameData.
- #to_s ⇒ Object
Constructor Details
#initialize(player_name, misses, right_guesses, chances, word_control, game_word, count) ⇒ GameData
Returns a new instance of GameData.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/paitin_hangman/game_data.rb', line 6 def initialize(player_name, misses, right_guesses, chances, word_control, game_word, count) @player_name = player_name @misses = misses @right_guesses = right_guesses @chances = chances @word_control = word_control @game_word = game_word @count = count end |
Instance Attribute Details
#chances ⇒ Object (readonly)
Returns the value of attribute chances.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def chances @chances end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def count @count end |
#game_word ⇒ Object (readonly)
Returns the value of attribute game_word.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def game_word @game_word end |
#misses ⇒ Object (readonly)
Returns the value of attribute misses.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def misses @misses end |
#player_name ⇒ Object (readonly)
Returns the value of attribute player_name.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def player_name @player_name end |
#right_guesses ⇒ Object (readonly)
Returns the value of attribute right_guesses.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def right_guesses @right_guesses end |
#word_control ⇒ Object (readonly)
Returns the value of attribute word_control.
3 4 5 |
# File 'lib/paitin_hangman/game_data.rb', line 3 def word_control @word_control end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 |
# File 'lib/paitin_hangman/game_data.rb', line 17 def to_s "#{player_name} ===>>> #{word_control.upcase.gsub('_', '__ ')}\n"\ "\t #{chances} chances left and you have used #{misses.join(', ')}\n" end |