Class: Codebreaker::Difficulties
- Inherits:
-
Object
- Object
- Codebreaker::Difficulties
- Defined in:
- lib/codebreaker/entities/difficulties.rb
Constant Summary collapse
- LEVELS =
{ easy: { attempts: 15, hints: 2 }, medium: { attempts: 10, hints: 2 }, hell: { attempts: 5, hints: 1 } }.freeze
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#hints ⇒ Object
readonly
Returns the value of attribute hints.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(difficulties) ⇒ Difficulties
constructor
A new instance of Difficulties.
Constructor Details
#initialize(difficulties) ⇒ Difficulties
Returns a new instance of Difficulties.
21 22 23 24 25 |
# File 'lib/codebreaker/entities/difficulties.rb', line 21 def initialize(difficulties) @level = difficulties @attempts = LEVELS[difficulties.to_sym][:attempts] @hints = LEVELS[difficulties.to_sym][:hints] end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
19 20 21 |
# File 'lib/codebreaker/entities/difficulties.rb', line 19 def attempts @attempts end |
#hints ⇒ Object (readonly)
Returns the value of attribute hints.
19 20 21 |
# File 'lib/codebreaker/entities/difficulties.rb', line 19 def hints @hints end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
19 20 21 |
# File 'lib/codebreaker/entities/difficulties.rb', line 19 def level @level end |
Class Method Details
.valid_difficult(difficulties) ⇒ Object
28 29 30 |
# File 'lib/codebreaker/entities/difficulties.rb', line 28 def valid_difficult(difficulties) Verifier.verify_valid_difficult(difficulties) end |