Class: WebUnit::InputRadio

Inherits:
Input show all
Defined in:
lib/webunit/params.rb

Instance Attribute Summary

Attributes inherited from Param

#name, #relations, #stat, #type, #value

Attributes inherited from HtmlElem

#array, #attrs, #children, #data, #name, #tag

Instance Method Summary collapse

Methods inherited from Input

#initialize, #inspect, #off

Methods inherited from Param

#initialize, #update

Methods inherited from HtmlElem

#append, #extract, #find, #has?, #initialize, #inspect, #print, #readlink, #search

Constructor Details

This class inherits a constructor from WebUnit::Input

Instance Method Details

#multipart_query_data(boundary) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/webunit/params.rb', line 80

def multipart_query_data( boundary)
  if @stat == 'on'
    super(boundary)
  else
    nil
  end
end

#onObject



68
69
70
71
72
73
# File 'lib/webunit/params.rb', line 68

def on
  @stat = 'on'
  @relations.each do |r|
    r.off
  end
end

#query_dataObject



75
76
77
78
# File 'lib/webunit/params.rb', line 75

def query_data
  value = @value ? CGI::escape( @value ) : ''
  (@stat == 'on' and @name) ? CGI::escape(@name) + '=' + value : nil
end

#value=(v) ⇒ Object



88
89
90
91
92
93
# File 'lib/webunit/params.rb', line 88

def value=( v )
  self.stat = self.value == v ? 'on' : 'off'
  @relations.each do |e|
    e.stat = e.value == v ? 'on' : 'off'
  end
end