Class: Mastermind::CurrentResult
- Inherits:
-
Object
- Object
- Mastermind::CurrentResult
- Defined in:
- lib/mastermind/GameStatus.rb
Instance Attribute Summary collapse
-
#guess ⇒ Object
readonly
Returns the value of attribute guess.
-
#num_of_tries ⇒ Object
readonly
Returns the value of attribute num_of_tries.
-
#result_hash ⇒ Object
readonly
Returns the value of attribute result_hash.
Instance Method Summary collapse
- #correct? ⇒ Boolean
-
#initialize(guess, num_of_tries, result_hash) ⇒ CurrentResult
constructor
A new instance of CurrentResult.
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
#guess ⇒ Object (readonly)
Returns the value of attribute guess.
40 41 42 |
# File 'lib/mastermind/GameStatus.rb', line 40 def guess @guess end |
#num_of_tries ⇒ Object (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_hash ⇒ Object (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
48 49 50 |
# File 'lib/mastermind/GameStatus.rb', line 48 def correct? @result_hash == WIN_HASH end |