Class: Aranha::Parsers::Html::Item

Inherits:
Base
  • Object
show all
Defined in:
lib/aranha/parsers/html/item.rb

Constant Summary

Constants inherited from Base

Base::LOG_DIR_ENVVAR

Instance Attribute Summary

Attributes inherited from Base

#source_address

Instance Method Summary collapse

Methods inherited from Base

field, fields, #nokogiri

Methods inherited from Base

#content, from_content, #initialize, parse_content

Constructor Details

This class inherits a constructor from Aranha::Parsers::Base

Instance Method Details

#dataObject



9
10
11
# File 'lib/aranha/parsers/html/item.rb', line 9

def data
  @data ||= node_parser.parse(item_node)
end

#item_nodeObject



13
14
15
16
17
18
19
20
# File 'lib/aranha/parsers/html/item.rb', line 13

def item_node
  @item_node ||= begin
    r = item_xpath ? nokogiri.at_xpath(item_xpath) : nokogiri
    raise "Item node not found (Item xpath: #{item_xpath})" unless r

    r
  end
end