Parent

Class Index [+]

Quicksearch

Mechanize::Form::Option

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

Attributes

value[R]
selected[R]
text[R]
select_list[R]

Public Class Methods

new(node, select_list) click to toggle source
    # File lib/mechanize/form/option.rb, line 14
14:       def initialize(node, select_list)
15:         @text     = node.inner_text
16:         @value    = Util.html_unescape(node['value'] || node.inner_text)
17:         @selected = node.has_attribute? 'selected'
18:         @select_list = select_list # The select list this option belongs to
19:       end

Public Instance Methods

click() click to toggle source

Toggle the selection value of this option

    # File lib/mechanize/form/option.rb, line 36
36:       def click
37:         unselect_peers
38:         @selected = !@selected
39:       end
select() click to toggle source

Select this option

    # File lib/mechanize/form/option.rb, line 22
22:       def select
23:         unselect_peers
24:         @selected = true
25:       end
Also aliased as: tick
tick() click to toggle source
Alias for: select
unselect() click to toggle source

Unselect this option

    # File lib/mechanize/form/option.rb, line 28
28:       def unselect
29:         @selected = false
30:       end
Also aliased as: untick
untick() click to toggle source
Alias for: unselect

Private Instance Methods

unselect_peers() click to toggle source
    # File lib/mechanize/form/option.rb, line 42
42:       def unselect_peers
43:         if @select_list.instance_of? SelectList
44:           @select_list.select_none
45:         end
46:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.