class Mechanize::Form::RadioButton
This class represents a radio button found in a Form. To activate the RadioButton
in the Form, set the checked method to true.
Attributes
checked[RW]
checked?[RW]
form[R]
Public Class Methods
new(node, form)
click to toggle source
Calls superclass method
Mechanize::Form::Field::new
# File lib/mechanize/form/radio_button.rb, line 10 def initialize node, form @checked = !!node['checked'] @form = form super(node) end
Public Instance Methods
[](key)
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 52 def [](key) @node[key] end
check()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 25 def check uncheck_peers @checked = true end
click()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 36 def click checked ? uncheck : check end
label()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 44 def label (id = self['id']) && @form.page.labels_hash[id] || nil end
text()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 48 def text label.text rescue nil end
uncheck()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 32 def uncheck @checked = false end
Private Instance Methods
uncheck_peers()
click to toggle source
# File lib/mechanize/form/radio_button.rb, line 62 def uncheck_peers @form.radiobuttons_with(:name => name).each do |b| next if b.value == value b.uncheck end end