Module: Bewildr::ControlTypeAdditions::TabAdditions
- Defined in:
- lib/bewildr/control_type_additions/tab_additions.rb
Instance Method Summary collapse
-
#select(input) ⇒ Object
Selects the tab whose name matches the input.
-
#selected ⇒ Object
Returns the selected tab.
-
#tab_names ⇒ Object
Returns a string array containing the names of all the tabs in the tab control.
-
#tabs ⇒ Object
Returns an array containing the tab items belonging to the tab control.
Instance Method Details
#select(input) ⇒ Object
Selects the tab whose name matches the input
7 8 9 10 11 |
# File 'lib/bewildr/control_type_additions/tab_additions.rb', line 7 def select(input) raise Bewildr::NoSuchTab unless tab_names.include?(input) selectable_elements = tabs selectable_elements.find {|selectable_element| selectable_element.name == input}.select end |
#selected ⇒ Object
Returns the selected tab
24 25 26 |
# File 'lib/bewildr/control_type_additions/tab_additions.rb', line 24 def selected tabs.find {|tab| tab.selected?} end |
#tab_names ⇒ Object
Returns a string array containing the names of all the tabs in the tab control
19 20 21 |
# File 'lib/bewildr/control_type_additions/tab_additions.rb', line 19 def tab_names tabs.collect {|tab| tab.name} end |
#tabs ⇒ Object
Returns an array containing the tab items belonging to the tab control
14 15 16 |
# File 'lib/bewildr/control_type_additions/tab_additions.rb', line 14 def tabs get(:type => :tab_item, :scope => :children, :how_many => :all) end |