Class: PaitinHangman::GameData

Inherits:
Object
  • Object
show all
Defined in:
lib/paitin_hangman/game_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#chancesObject (readonly)

Returns the value of attribute chances.



3
4
5
# File 'lib/paitin_hangman/game_data.rb', line 3

def chances
  @chances
end

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'lib/paitin_hangman/game_data.rb', line 3

def count
  @count
end

#game_wordObject (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

#missesObject (readonly)

Returns the value of attribute misses.



3
4
5
# File 'lib/paitin_hangman/game_data.rb', line 3

def misses
  @misses
end

#player_nameObject (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_guessesObject (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_controlObject (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_sObject



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