Class: Scrapetor::Dom::AttrNode
- Inherits:
-
Object
- Object
- Scrapetor::Dom::AttrNode
- Defined in:
- lib/scrapetor/dom.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value, owner) ⇒ AttrNode
constructor
A new instance of AttrNode.
-
#text ⇒ Object
(also: #content, #inner_text)
Nokogiri-compat: attribute nodes expose .text / .content / .inner_text that return the attribute’s value.
- #to_s ⇒ Object
Constructor Details
#initialize(name, value, owner) ⇒ AttrNode
Returns a new instance of AttrNode.
406 407 408 409 410 |
# File 'lib/scrapetor/dom.rb', line 406 def initialize(name, value, owner) @name = name @value = value @owner = owner end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
405 406 407 |
# File 'lib/scrapetor/dom.rb', line 405 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
405 406 407 |
# File 'lib/scrapetor/dom.rb', line 405 def owner @owner end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
405 406 407 |
# File 'lib/scrapetor/dom.rb', line 405 def value @value end |
Instance Method Details
#text ⇒ Object Also known as: content, inner_text
Nokogiri-compat: attribute nodes expose .text / .content / .inner_text that return the attribute’s value. Real-world code iterates ‘node.attribute_nodes` and reads `.text` on each.
415 |
# File 'lib/scrapetor/dom.rb', line 415 def text; @value.to_s; end |
#to_s ⇒ Object
411 |
# File 'lib/scrapetor/dom.rb', line 411 def to_s; "#{@name}=\"#{@value}\""; end |