Class: Mechanize::Form::RadioButton

### Home Classes Methods

### In Files

- lib/mechanize/form/radio_button.rb

### Parent

Mechanize::Form::Field

### Methods

- ::new
- #[]
- #check
- #click
- #label
- #text
- #uncheck

### Files

- EXAMPLES.rdoc
- GUIDE.rdoc
- LICENSE.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Mechanize
- Mechanize::ChunkedTerminationError
- Mechanize::ContentTypeError
- Mechanize::Cookie
- Mechanize::CookieCMethods
- Mechanize::CookieDeprecated
- Mechanize::CookieIMethods
- Mechanize::CookieJar
- Mechanize::CookieJarIMethods
- Mechanize::DirectorySaver
- Mechanize::Download
- Mechanize::ElementMatcher
- Mechanize::ElementNotFoundError
- Mechanize::Error
- Mechanize::File
- Mechanize::FileConnection
- Mechanize::FileRequest
- Mechanize::FileResponse
- Mechanize::FileSaver
- Mechanize::Form
- Mechanize::Form::Button
- Mechanize::Form::CheckBox
- Mechanize::Form::Field
- Mechanize::Form::FileUpload
- Mechanize::Form::Hidden
- Mechanize::Form::ImageButton
- Mechanize::Form::Keygen
- Mechanize::Form::MultiSelectList
- Mechanize::Form::Option
- Mechanize::Form::RadioButton
- Mechanize::Form::Reset
- Mechanize::Form::SelectList
- Mechanize::Form::Submit
- Mechanize::Form::Text
- Mechanize::Form::Textarea
- Mechanize::HTTP
- Mechanize::HTTP::Agent
- Mechanize::HTTP::AuthChallenge
- Mechanize::HTTP::AuthRealm
- Mechanize::HTTP::AuthStore
- Mechanize::HTTP::ContentDispositionParser
- Mechanize::HTTP::WWWAuthenticateParser
- Mechanize::Headers
- Mechanize::History
- Mechanize::Image
- Mechanize::Page
- Mechanize::Page::Base
- Mechanize::Page::Frame
- Mechanize::Page::Image
- Mechanize::Page::Label
- Mechanize::Page::Link
- Mechanize::Page::MetaRefresh
- Mechanize::Parser
- Mechanize::PluggableParser
- Mechanize::Prependable
- Mechanize::RedirectLimitReachedError
- Mechanize::RedirectNotGetOrHeadError
- Mechanize::ResponseCodeError
- Mechanize::ResponseReadError
- Mechanize::RobotsDisallowedError
- Mechanize::TestCase
- Mechanize::UnauthorizedError
- Mechanize::UnsupportedSchemeError
- Mechanize::Util
- Mechanize::XmlFile
- HTTP
- HTTP::CookieJar

No matching classes.

# 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

    # File lib/mechanize/form/radio_button.rb, line 9
    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 51
    def [](key)
      @node[key]
    end

check() click to toggle source

    # File lib/mechanize/form/radio_button.rb, line 24
    def check
      uncheck_peers
      @checked = true
    end

click() click to toggle source

    # File lib/mechanize/form/radio_button.rb, line 35
    def click
      checked ? uncheck : check
    end

label() click to toggle source

    # File lib/mechanize/form/radio_button.rb, line 43
    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 47
    def text
      label.text rescue nil
    end

uncheck() click to toggle source

    # File lib/mechanize/form/radio_button.rb, line 31
    def uncheck
      @checked = false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.