| Class | Mechanize::Form::Field |
| In: |
lib/mechanize/form/field.rb
|
| Parent: | Object |
This class represents a field in a form. It handles the following input tags found in a form: text, password, hidden, int, textarea
To set the value of a field, just use the value method: field.value = "foo"
| name | [RW] | |
| node | [RW] | |
| value | [RW] |
# File lib/mechanize/form/field.rb, line 12
12: def initialize node, value = node['value']
13: @node = node
14: @name = Util.html_unescape(node['name'])
15: @value = if value.is_a? String
16: Util.html_unescape(value)
17: else
18: value
19: end
20: end
# File lib/mechanize/form/field.rb, line 26
26: def <=> other
27: return 0 if self == other
28: return 1 if Hash === node
29: return -1 if Hash === other.node
30: node <=> other.node
31: end