Class: Dill::FieldGroup::Select
- Defined in:
- lib/dill/field_group.rb
Overview
A select.
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#get ⇒ String
The text of the selected option.
-
#set(option) ⇒ Object
Selects the given option.
-
#to_s ⇒ Object
The text of the selected option, or the empty string if no option is selected.
Methods inherited from Field
Methods inherited from Widget
#!=, #!~, #<, #<=, #==, #=~, #>, #>=, action, #click, #diff, find_in, #has_action?, #initialize, #inspect, #match, present_in?, #reload, root, selector, #text, #to_cell, #to_f, #to_i, widget, widget_delegator
Methods included from WidgetContainer
Constructor Details
This class inherits a constructor from Dill::Widget
Instance Method Details
#get ⇒ String
Returns The text of the selected option.
294 295 296 297 298 |
# File 'lib/dill/field_group.rb', line 294 def get option = root.find('[selected]') rescue nil option && option.text end |
#set(option) ⇒ Object
Selects the given option.
303 304 305 |
# File 'lib/dill/field_group.rb', line 303 def set(option) root.find('option', text: option).select_option end |
#to_s ⇒ Object
Returns the text of the selected option, or the empty string if no option is selected.
310 |
# File 'lib/dill/field_group.rb', line 310 def_delegator :get, :to_s |