Class: LessForm::Options
- Inherits:
-
Object
- Object
- LessForm::Options
- Defined in:
- lib/less-form/options.rb
Instance Method Summary collapse
- #all ⇒ Object
- #by_text(text) ⇒ Object
- #by_value(value) ⇒ Object
-
#initialize(select_element) ⇒ Options
constructor
A new instance of Options.
- #selected ⇒ Object
Constructor Details
#initialize(select_element) ⇒ Options
Returns a new instance of Options.
3 4 5 |
# File 'lib/less-form/options.rb', line 3 def initialize select_element @elements = select_element.find_elements(:css, 'option') end |
Instance Method Details
#all ⇒ Object
7 8 9 |
# File 'lib/less-form/options.rb', line 7 def all @elements.map {|e| e.text } end |
#by_text(text) ⇒ Object
15 16 17 |
# File 'lib/less-form/options.rb', line 15 def by_text text Option.new @elements.detect {|e| e.text == text} end |