Class: CodebreakerRostik::Difficulty
- Inherits:
-
Object
- Object
- CodebreakerRostik::Difficulty
- Defined in:
- lib/difficulty.rb
Constant Summary collapse
- DIFFICULTIES =
{ easy: { difficulty: 'Easy', attempts_total: 15, hints_total: 2 }, medium: { difficulty: 'Medium', attempts_total: 10, hints_total: 1 }, hell: { difficulty: 'Hell', attempts_total: 5, hints_total: 1 } }.freeze
Instance Method Summary collapse
- #choose_difficulty ⇒ Object
-
#initialize(difficulty) ⇒ Difficulty
constructor
A new instance of Difficulty.
Constructor Details
#initialize(difficulty) ⇒ Difficulty
Returns a new instance of Difficulty.
21 22 23 |
# File 'lib/difficulty.rb', line 21 def initialize(difficulty) @difficulty = difficulty.downcase.to_sym if difficulty end |
Instance Method Details
#choose_difficulty ⇒ Object
25 26 27 |
# File 'lib/difficulty.rb', line 25 def choose_difficulty return DIFFICULTIES[@difficulty] if DIFFICULTIES.key?(@difficulty) end |