Class: BeforeGame::DifficultChooser

Inherits:
Object
  • Object
show all
Defined in:
lib/codebreaker/before_game/difficult_chooser.rb

Constant Summary collapse

DIFFICULT_VARIANTS =
[
  { name: 'easy', attempts: 15, hints: 2 },
  { name: 'medium', attempts: 10, hints: 1 },
  { name: 'hell', attempts: 5, hints: 1 }
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(difficult_variant:) ⇒ DifficultChooser

Returns a new instance of DifficultChooser.



13
14
15
16
17
# File 'lib/codebreaker/before_game/difficult_chooser.rb', line 13

def initialize(difficult_variant:)
  @name = difficult_variant[:name]
  @attempts_count = difficult_variant[:attempts]
  @hint = BeforeGame::Hint.new(hints_count: difficult_variant[:hints])
end

Instance Attribute Details

#attempts_countObject

Returns the value of attribute attempts_count.



11
12
13
# File 'lib/codebreaker/before_game/difficult_chooser.rb', line 11

def attempts_count
  @attempts_count
end

#hintObject

Returns the value of attribute hint.



11
12
13
# File 'lib/codebreaker/before_game/difficult_chooser.rb', line 11

def hint
  @hint
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/codebreaker/before_game/difficult_chooser.rb', line 11

def name
  @name
end