Class: RETerm::Components::Rocker
- Inherits:
-
RETerm::Component
- Object
- RETerm::Component
- RETerm::Components::Rocker
- Includes:
- RETerm::ComponentInput
- Defined in:
- lib/reterm/components/rocker.rb
Overview
Rocker component, allowing use to select one of several values
Constant Summary
Constants included from RETerm::ComponentInput
RETerm::ComponentInput::DEC_CONTROLS, RETerm::ComponentInput::INC_CONTROLS, RETerm::ComponentInput::QUIT_CONTROLS
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#values ⇒ Object
Returns the value of attribute values.
Attributes inherited from RETerm::Component
Instance Method Summary collapse
- #activatable? ⇒ Boolean
- #activate! ⇒ Object
- #draw! ⇒ Object
-
#initialize(args = {}) ⇒ Rocker
constructor
Initialize the Rocker component.
Methods included from RETerm::ComponentInput
Methods inherited from RETerm::Component
#colored?, #colors=, #finalize!
Constructor Details
#initialize(args = {}) ⇒ Rocker
Initialize the Rocker component
20 21 22 23 24 25 |
# File 'lib/reterm/components/rocker.rb', line 20 def initialize(args={}) @values = [] @index = nil @labels = true @index = 0 end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
7 8 9 |
# File 'lib/reterm/components/rocker.rb', line 7 def index @index end |
#labels ⇒ Object
Returns the value of attribute labels.
7 8 9 |
# File 'lib/reterm/components/rocker.rb', line 7 def labels @labels end |
#values ⇒ Object
Returns the value of attribute values.
7 8 9 |
# File 'lib/reterm/components/rocker.rb', line 7 def values @values end |
Instance Method Details
#activatable? ⇒ Boolean
31 32 33 |
# File 'lib/reterm/components/rocker.rb', line 31 def activatable? true end |
#activate! ⇒ Object
35 36 37 38 39 |
# File 'lib/reterm/components/rocker.rb', line 35 def activate! refresh_win handle_input @values[@index] end |
#draw! ⇒ Object
27 28 29 |
# File 'lib/reterm/components/rocker.rb', line 27 def draw! refresh_win end |