Class: Difficulty
- Inherits:
-
Object
- Object
- Difficulty
- Includes:
- CodebreakerConstants
- Defined in:
- lib/modules/difficulty.rb
Constant Summary
Constants included from CodebreakerConstants
CodebreakerConstants::CODE_SIZE, CodebreakerConstants::DIFFICULTY, CodebreakerConstants::DIFFICULTY_SORT, CodebreakerConstants::FILE_NAME, CodebreakerConstants::MINUS, CodebreakerConstants::NUM_RANGE, CodebreakerConstants::PLUS
Instance Attribute Summary collapse
-
#attempts ⇒ Object
Returns the value of attribute attempts.
-
#hints ⇒ Object
Returns the value of attribute hints.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Difficulty
constructor
A new instance of Difficulty.
Constructor Details
#initialize(name) ⇒ Difficulty
Returns a new instance of Difficulty.
7 8 9 10 11 12 13 |
# File 'lib/modules/difficulty.rb', line 7 def initialize(name) return unless valid?(name) @name = name @hints = DIFFICULTY[name.to_sym][:hints] @attempts = DIFFICULTY[name.to_sym][:attempts] end |
Instance Attribute Details
#attempts ⇒ Object
Returns the value of attribute attempts.
5 6 7 |
# File 'lib/modules/difficulty.rb', line 5 def attempts @attempts end |
#hints ⇒ Object
Returns the value of attribute hints.
5 6 7 |
# File 'lib/modules/difficulty.rb', line 5 def hints @hints end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/modules/difficulty.rb', line 5 def name @name end |