Class: Mastermind::CurrentResult

Inherits:
Object
  • Object
show all
Defined in:
lib/mastermind/GameStatus.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(guess, num_of_tries, result_hash) ⇒ CurrentResult

Returns a new instance of CurrentResult.



42
43
44
45
46
# File 'lib/mastermind/GameStatus.rb', line 42

def initialize(guess, num_of_tries, result_hash)
  @guess = guess
  @num_of_tries = num_of_tries
  @result_hash = result_hash
end

Instance Attribute Details

#guessObject (readonly)

Returns the value of attribute guess.



40
41
42
# File 'lib/mastermind/GameStatus.rb', line 40

def guess
  @guess
end

#num_of_triesObject (readonly)

Returns the value of attribute num_of_tries.



40
41
42
# File 'lib/mastermind/GameStatus.rb', line 40

def num_of_tries
  @num_of_tries
end

#result_hashObject (readonly)

Returns the value of attribute result_hash.



39
40
41
# File 'lib/mastermind/GameStatus.rb', line 39

def result_hash
  @result_hash
end

Instance Method Details

#correct?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/mastermind/GameStatus.rb', line 48

def correct?   
  @result_hash == WIN_HASH
end