Class: CodebreakerRuban::Console
- Inherits:
-
Object
- Object
- CodebreakerRuban::Console
- Defined in:
- lib/app/entities/console.rb
Constant Summary collapse
- OPTION =
{ rules: 'rules', start: 'start', stats: 'stats', exit: 'exit' }.freeze
- HINT =
'hint'- WIN =
'++++'- YES =
%w[yes y].freeze
- EASY_STRING =
'easy'- MEDIUM_STRING =
'medium'- HELL_STRING =
'hell'
Instance Attribute Summary collapse
-
#difficulty ⇒ Object
Returns the value of attribute difficulty.
-
#game ⇒ Object
Returns the value of attribute game.
-
#state ⇒ Object
Returns the value of attribute state.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize ⇒ Console
constructor
A new instance of Console.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Console
Returns a new instance of Console.
20 21 22 |
# File 'lib/app/entities/console.rb', line 20 def initialize set_state(:choice_option) end |
Instance Attribute Details
#difficulty ⇒ Object
Returns the value of attribute difficulty.
5 6 7 |
# File 'lib/app/entities/console.rb', line 5 def difficulty @difficulty end |
#game ⇒ Object
Returns the value of attribute game.
5 6 7 |
# File 'lib/app/entities/console.rb', line 5 def game @game end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/app/entities/console.rb', line 5 def state @state end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/app/entities/console.rb', line 5 def user @user end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/app/entities/console.rb', line 24 def run Message.greeting loop do send(state) break if state == :game_over end Message.goodbye end |