Class: Ginbin::Menu
- Inherits:
-
Object
- Object
- Ginbin::Menu
- Defined in:
- lib/ginbin/menu.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #call ⇒ Object
- #choices ⇒ Object
-
#initialize(items: ItemsFromConfig.new, title: "Root") ⇒ Menu
constructor
A new instance of Menu.
Constructor Details
#initialize(items: ItemsFromConfig.new, title: "Root") ⇒ Menu
Returns a new instance of Menu.
10 11 12 13 |
# File 'lib/ginbin/menu.rb', line 10 def initialize(items: ItemsFromConfig.new, title: "Root") @items = items @title = title end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/ginbin/menu.rb', line 8 def title @title end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 |
# File 'lib/ginbin/menu.rb', line 15 def call prompt = TTY::Prompt.new prompt.enum_select("Choose command", choices).call end |