Class: Codebreaker::Entities::Menu
- Inherits:
-
Object
- Object
- Codebreaker::Entities::Menu
- Includes:
- Modules::Validator
- Defined in:
- lib/codebreaker/entities/menu.rb
Constant Summary collapse
- COMMANDS =
{ start: 'start', exit: 'exit', rules: 'rules', stats: 'stats' }.freeze
- CHOOSE_COMMANDS =
{ yes: 'yes' }.freeze
- HINT_COMMAND =
'hint'
- MIN_SIZE_VALUE =
3
- MAX_SIZE_VALUE =
20
Constants included from Modules::Validator
Modules::Validator::VALUE_FORMAT
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
-
#guess ⇒ Object
readonly
Returns the value of attribute guess.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
- #game_menu ⇒ Object
-
#initialize ⇒ Menu
constructor
A new instance of Menu.
Methods included from Modules::Validator
#check_command_range, #check_emptyness, #check_length
Constructor Details
#initialize ⇒ Menu
Returns a new instance of Menu.
22 23 24 25 26 27 |
# File 'lib/codebreaker/entities/menu.rb', line 22 def initialize @storage = DataStorage.new @renderer = Renderer.new @game = Game.new @statistics = Statistics.new end |
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
7 8 9 |
# File 'lib/codebreaker/entities/menu.rb', line 7 def game @game end |
#guess ⇒ Object (readonly)
Returns the value of attribute guess.
7 8 9 |
# File 'lib/codebreaker/entities/menu.rb', line 7 def guess @guess end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
7 8 9 |
# File 'lib/codebreaker/entities/menu.rb', line 7 def renderer @renderer end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
7 8 9 |
# File 'lib/codebreaker/entities/menu.rb', line 7 def storage @storage end |
Instance Method Details
#game_menu ⇒ Object
29 30 31 32 33 |
# File 'lib/codebreaker/entities/menu.rb', line 29 def renderer. (ask(:choice_options, commands: COMMANDS.keys.join(' | '))) end |