This class contains 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.
To select the first option in a list:
select_list.first.tick
# File lib/mechanize/form/option.rb, line 16 16: def initialize(node, select_list) 17: @text = node.inner_text 18: @value = Mechanize::Util.html_unescape(node['value'] || node.inner_text) 19: @selected = node.has_attribute? 'selected' 20: @select_list = select_list # The select list this option belongs to 21: end
Toggle the selection value of this option
# File lib/mechanize/form/option.rb, line 38 38: def click 39: unselect_peers 40: @selected = !@selected 41: end
Select this option
# File lib/mechanize/form/option.rb, line 24 24: def select 25: unselect_peers 26: @selected = true 27: end
Unselect this option
# File lib/mechanize/form/option.rb, line 30 30: def unselect 31: @selected = false 32: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.