Class: Web::Unit::InputRadio

Inherits:
Input show all
Defined in:
lib/web/unit/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 Web::Unit::Input

Instance Method Details

#multipart_query_data(boundary) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/web/unit/params.rb', line 81

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

#onObject



69
70
71
72
73
74
# File 'lib/web/unit/params.rb', line 69

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

#query_dataObject



76
77
78
79
# File 'lib/web/unit/params.rb', line 76

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

#value=(v) ⇒ Object



89
90
91
92
93
94
# File 'lib/web/unit/params.rb', line 89

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