class LessForm::Options
Public Class Methods
new(select_element)
click to toggle source
# File lib/less-form/options.rb, line 3 def initialize select_element @elements = select_element.find_elements(:css, 'option') end
Public Instance Methods
all()
click to toggle source
# File lib/less-form/options.rb, line 7 def all @elements.map {|e| e.text } end
by_text(text)
click to toggle source
# File lib/less-form/options.rb, line 15 def by_text text Option.new @elements.detect {|e| e.text == text} end
by_value(value)
click to toggle source
# File lib/less-form/options.rb, line 11 def by_value value Option.new @elements.detect {|e| e.attribute('value') == value} end
selected()
click to toggle source
# File lib/less-form/options.rb, line 19 def selected Option.new @elements.detect {|e| e.selected?} end