Class: Belajar::Views::Menu
- Inherits:
-
Object
- Object
- Belajar::Views::Menu
- Includes:
- Belajar::Views, Wisper::Publisher
- Defined in:
- lib/belajar/views/menu.rb
Direct Known Subclasses
Constant Summary collapse
- TOP_BAR_TEXT =
[ 'Use * ← * and * → * for menu navigation', 'Enter menu with * ⏎ *', 'Go back with * ⟵ *', 'Exit with *Esc*' ].join(' | ').freeze
Instance Attribute Summary collapse
-
#items_info ⇒ Object
writeonly
Sets the attribute items_info.
Instance Method Summary collapse
- #enter(*args) ⇒ Object
-
#initialize ⇒ Menu
constructor
A new instance of Menu.
- #reenter(*args) ⇒ Object
Methods included from Belajar::Views
Constructor Details
#initialize ⇒ Menu
Returns a new instance of Menu.
18 19 20 |
# File 'lib/belajar/views/menu.rb', line 18 def initialize @position = 0 end |
Instance Attribute Details
#items_info=(value) ⇒ Object
Sets the attribute items_info
16 17 18 |
# File 'lib/belajar/views/menu.rb', line 16 def items_info=(value) @items_info = value end |
Instance Method Details
#enter(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/belajar/views/menu.rb', line 22 def enter(*args) if self.class.private_method_defined?(:before_enter) before_enter(*args) end @window = default_window = TopBar.new(@window, TOP_BAR_TEXT) show (@window, ) end |
#reenter(*args) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/belajar/views/menu.rb', line 32 def reenter(*args) if self.class.private_method_defined?(:before_reenter) before_reenter(*args) end enter(*args) end |