Class: Mechanize::Page::Label
- Inherits:
-
Object
- Object
- Mechanize::Page::Label
- Defined in:
- lib/mechanize/page/label.rb
Overview
A form label on an HTML page
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#text ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #for ⇒ Object
-
#initialize(node, page) ⇒ Label
constructor
A new instance of Label.
Constructor Details
#initialize(node, page) ⇒ Label
Returns a new instance of Label.
11 12 13 14 15 |
# File 'lib/mechanize/page/label.rb', line 11 def initialize(node, page) @node = node @text = node.inner_text @page = page end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
6 7 8 |
# File 'lib/mechanize/page/label.rb', line 6 def node @node end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'lib/mechanize/page/label.rb', line 8 def page @page end |
#text ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute text.
7 8 9 |
# File 'lib/mechanize/page/label.rb', line 7 def text @text end |
Instance Method Details
#for ⇒ Object
17 18 19 |
# File 'lib/mechanize/page/label.rb', line 17 def for (id = @node['for']) && page.search("##{id}") || nil end |