Class: Vvm::CLI::Command::ShowMainMenu
- Defined in:
- lib/vvm/cli/command/show_main_menu.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
by_command_name, inherited, #initialize
Constructor Details
This class inherits a constructor from Vvm::CLI::Command::Base
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vvm/cli/command/show_main_menu.rb', line 9 def call prompt.say("Balance: $#{machine.balance}") choices = [ { name: 'Insert a coin', value: :insert_coin, **maybe_out_of_stock }, { name: 'Pick the product', value: :pick_product }, { name: 'Dispense', value: :dispense, **maybe_empty_balance, **maybe_no_change }, { name: 'Exit', value: :exit } ] result = prompt.select('Main menu:', choices) env.call(result) end |