This class contains option an option found within SelectList. A SelectList can have many Option classes associated with it. An option can be selected by calling Option#tick, or Option#click. For example, select the first option in a list:
select_list.first.tick
# File lib/mechanize/form/option.rb, line 14 def initialize(node, select_list) @text = node.inner_text @value = Util.html_unescape(node['value'] || node.inner_text) @selected = node.has_attribute? 'selected' @select_list = select_list # The select list this option belongs to end
Toggle the selection value of this option
# File lib/mechanize/form/option.rb, line 36 def click unselect_peers @selected = !@selected end
Select this option
# File lib/mechanize/form/option.rb, line 22 def select unselect_peers @selected = true end
Unselect this option
# File lib/mechanize/form/option.rb, line 28 def unselect @selected = false end
Generated with the Darkfish Rdoc Generator 2.