Class: Scrapetor::Native::Element::AttrNode

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



121
122
123
# File 'lib/scrapetor/native_dom.rb', line 121

def name
  @name
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



121
122
123
# File 'lib/scrapetor/native_dom.rb', line 121

def value
  @value
end

Instance Method Details

#textObject Also known as: content, inner_text



122
# File 'lib/scrapetor/native_dom.rb', line 122

def text;       value.to_s; end

#to_sObject



125
126
127
# File 'lib/scrapetor/native_dom.rb', line 125

def to_s
  %Q{#{name}="#{value}"}
end