Class: Aranha::Parsers::Html::ItemList
- Inherits:
-
Base
- Object
- Base
- Base
- Aranha::Parsers::Html::ItemList
show all
- Defined in:
- lib/aranha/parsers/html/item_list.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, from_node, #nokogiri, xpath_contains_class, xpath_ends_with
Methods inherited from Base
#content, #content_encoding, from_content, from_string, #initialize, #source_address_content
Instance Method Details
#data ⇒ Object
9
10
11
|
# File 'lib/aranha/parsers/html/item_list.rb', line 9
def data
items_data
end
|
#item_data(item) ⇒ Object
13
14
15
|
# File 'lib/aranha/parsers/html/item_list.rb', line 13
def item_data(item)
item
end
|
#items_data ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/aranha/parsers/html/item_list.rb', line 17
def items_data
count = 0
@data ||= nokogiri.xpath(items_xpath).map do |m|
count += 1
item_data(node_parser.parse(m))
end
rescue StandardError => e
raise StandardError, "#{e.message} (Count: #{count})"
end
|
#items_xpath ⇒ Object
27
28
29
|
# File 'lib/aranha/parsers/html/item_list.rb', line 27
def items_xpath
raise "Class #{self.class} has no method \"#{__method__}\". Implement it"
end
|