Class: Eclair::GroupItem
Direct Known Subclasses
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#visible ⇒ Object
Returns the value of attribute visible.
Attributes inherited from Item
Instance Method Summary collapse
- #color ⇒ Object
-
#initialize(label, items) ⇒ GroupItem
constructor
A new instance of GroupItem.
- #length ⇒ Object
- #select(state) ⇒ Object
- #toggle_select ⇒ Object
Methods inherited from Item
#command, #header, #id, #search_key, #title
Methods included from ConfigHelper
Constructor Details
#initialize(label, items) ⇒ GroupItem
Returns a new instance of GroupItem.
7 8 9 10 11 |
# File 'lib/eclair/group_item.rb', line 7 def initialize label, items @label = label @items = items @visible = true end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/eclair/group_item.rb', line 4 def label @label end |
#visible ⇒ Object
Returns the value of attribute visible.
5 6 7 |
# File 'lib/eclair/group_item.rb', line 5 def visible @visible end |
Instance Method Details
#color ⇒ Object
29 30 31 |
# File 'lib/eclair/group_item.rb', line 29 def color [Curses::COLOR_WHITE, -1, Curses::A_BOLD] end |
#length ⇒ Object
25 26 27 |
# File 'lib/eclair/group_item.rb', line 25 def length @items.length end |
#select(state) ⇒ Object
21 22 23 |
# File 'lib/eclair/group_item.rb', line 21 def select state @items.each{|i| i.select(state) } end |
#toggle_select ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/eclair/group_item.rb', line 13 def toggle_select if @items.all?(&:selected) @items.each{|i| i.select(false) } else @items.each{|i| i.select(true) } end end |