Class: Scrapetor::Native::Element::AttrNode
- Inherits:
-
Struct
- Object
- Struct
- Scrapetor::Native::Element::AttrNode
- Defined in:
- lib/scrapetor/native_dom.rb
Overview
Lightweight pair returned from ‘attribute_nodes` / `attribute`. The `.text` / `.content` / `.inner_text` accessors mirror what Nokogiri’s Nokogiri::XML::Attr exposes — production parser code iterates ‘node.attribute_nodes` and reads `.text` on each.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #text ⇒ Object (also: #content, #inner_text)
- #to_s ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
121 122 123 |
# File 'lib/scrapetor/native_dom.rb', line 121 def name @name end |
#value ⇒ Object
Returns the value of attribute value
121 122 123 |
# File 'lib/scrapetor/native_dom.rb', line 121 def value @value end |
Instance Method Details
#text ⇒ Object Also known as: content, inner_text
122 |
# File 'lib/scrapetor/native_dom.rb', line 122 def text; value.to_s; end |
#to_s ⇒ Object
125 126 127 |
# File 'lib/scrapetor/native_dom.rb', line 125 def to_s %Q{#{name}="#{value}"} end |