Class: Difficult
- Inherits:
-
Object
- Object
- Difficult
- Defined in:
- lib/console_app/difficult.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Instance Method Summary collapse
-
#initialize(level) ⇒ Difficult
constructor
A new instance of Difficult.
- #to_i ⇒ Object
Constructor Details
#initialize(level) ⇒ Difficult
Returns a new instance of Difficult.
4 5 6 |
# File 'lib/console_app/difficult.rb', line 4 def initialize(level) @level = level.downcase end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
2 3 4 |
# File 'lib/console_app/difficult.rb', line 2 def level @level end |
Instance Method Details
#to_i ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/console_app/difficult.rb', line 8 def to_i case @level when name('hell') then 1 when name('medium') then 2 when name('easy') then 3 end end |