Class: Celerity::Radio

Inherits:
Celerity::RadioCheckCommon show all
Defined in:
lib/celerity/elements/radio_check.rb

Overview

This class is the representation of a radio button.

Constant Summary

TAGS =
[Identifier.new('input', :type => %w[radio])]

Constants inherited from Celerity::RadioCheckCommon

DEFAULT_HOW

Constants inherited from Celerity::InputElement

ATTRIBUTES

Constants inherited from Celerity::Element

ATTRIBUTES, BASE_ATTRIBUTES, CELLHALIGN_ATTRIBUTES, CELLVALIGN_ATTRIBUTES, DEFAULT_HOW, HTML_401_TRANSITIONAL, TAGS

Method Summary

Methods inherited from Celerity::RadioCheckCommon

#clear, #set?

Methods inherited from Celerity::InputElement

#assert_not_readonly, #readonly?

Methods included from Celerity::ClickableElement

#assert_exists_and_enabled, #click, #click_and_attach, #double_click, #download, #right_click

Methods included from Celerity::DisabledElement

#assert_enabled, #disabled?, #enabled?

Methods inherited from Celerity::Element

#==, #assert_exists, #attribute_string, #attribute_value, #exists?, #fire_event, #focus, #identifier_string, #javascript_object, #locate, #method_missing, #methods, #object, #parent, #respond_to?, #selector_to_attribute, #text, #to_s, #to_xml, #visible?, #xpath

Methods included from Celerity::Container

#area, #areas, #button, #buttons, #cell, #cells, #check_box, #checkboxes, #container=, #contains_text, #dd, #dds, #div, #divs, #dl, #dls, #dt, #dts, #em, #ems, #file_field, #file_fields, #form, #forms, #frame, #frames, #h1, #h1s, #h2, #h2s, #h3, #h3s, #h4, #h4s, #h5, #h5s, #h6, #h6s, #hidden, #hiddens, #image, #images, #inspect, #label, #labels, #li, #link, #links, #lis, #map, #maps, #meta, #metas, #ol, #ols, #option, #p, #pre, #pres, #ps, #radio, #radios, #rescue_status_code_exception, #row, #rows, #select_list, #select_lists, #span, #spans, #strong, #strongs, #table, #tables, #tbodies, #tbody, #text_field, #text_fields, #tfoot, #tfoots, #th, #thead, #theads, #ths, #ul, #uls

Methods included from Celerity::ShortInspect

#short_inspect

Constructor Details

- (Radio) initialize(container, *args)

A new instance of Radio

Returns:

  • (Radio) — a new instance of Radio


57
58
59
# File 'lib/celerity/elements/radio_check.rb', line 57

def initialize(container, *args)
  super(container, %w[radio], *args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Celerity::Element

Method Details

- (Object) set(value = true)

Set the radio button to the given value.

  radio.set?        #=> false
  radio.set
  radio.set?        #=> true
  radio.set(false)
  radio.set?        #=> false


71
72
73
74
75
# File 'lib/celerity/elements/radio_check.rb', line 71

def set(value = true)
  assert_exists
  assert_enabled
  value ? @object.click : @object.setChecked(value)
end