Class: CodebreakerRostik::Difficulty

Inherits:
Object
  • Object
show all
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

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_difficultyObject



25
26
27
# File 'lib/difficulty.rb', line 25

def choose_difficulty
  return DIFFICULTIES[@difficulty] if DIFFICULTIES.key?(@difficulty)
end