Sha256: 6960204f83114b2939392be8eada5415c93801859f09b6c45dc296d646d36760

Contents?: true

Size: 551 Bytes

Versions: 5

Compression:

Stored size: 551 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module Aranha
  module Parsers
    module Html
      class ItemList < Base
        def data
          count = 0
          @data ||= nokogiri.xpath(items_xpath).map do |m|
            count += 1
            node_parser.parse(m)
          end
        rescue StandardError => e
          e.message << " / Count: #{count}"
          raise e
        end

        def items_xpath
          raise "Class #{self.class} has no method \"item_xpath\". Implement it"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aranha-0.9.0 lib/aranha/parsers/html/item_list.rb
aranha-0.8.0 lib/aranha/parsers/html/item_list.rb
aranha-0.7.1 lib/aranha/parsers/html/item_list.rb
aranha-0.7.0 lib/aranha/parsers/html/item_list.rb
aranha-0.6.0 lib/aranha/parsers/html/item_list.rb