class Mechanize::Form::SelectList
This class represents a select list or drop down box in a Form. Set the value for the list by calling SelectList#value=
. SelectList
contains a list of Option that were found. After finding the correct option, set the select lists value to the option value:
selectlist.value = selectlist.options.first.value
Options can also be selected by “clicking” or selecting them. See Option
Public Class Methods
Source
# File lib/mechanize/form/select_list.rb, line 12 def initialize node super if selected_options.length > 1 selected_options.reverse[1..selected_options.length].each do |o| o.unselect end end end
Calls superclass method
Mechanize::Form::MultiSelectList::new
Public Instance Methods
Source
# File lib/mechanize/form/select_list.rb, line 40 def query_value value ? [[name, value]] : nil end
Source
# File lib/mechanize/form/select_list.rb, line 21 def value value = super if value.length > 0 value.last elsif @options.length > 0 @options.first.value else nil end end
Calls superclass method
Mechanize::Form::MultiSelectList#value
Source
# File lib/mechanize/form/select_list.rb, line 32 def value=(new_value) if new_value != new_value.to_s and new_value.respond_to? :first super([new_value.first]) else super([new_value.to_s]) end end
Calls superclass method
Mechanize::Form::MultiSelectList#value=