Sha256: 21cbbc9d6f12e2357b2fd1e67b8b5ed7120da8457a89a892614cab8180c1e15d

Contents?: true

Size: 526 Bytes

Versions: 6

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

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

6 entries across 6 versions & 1 rubygems

Version Path
aranha-0.5.0 lib/aranha/parsers/html/item_list.rb
aranha-0.4.0 lib/aranha/parsers/html/item_list.rb
aranha-0.3.0 lib/aranha/parsers/html/item_list.rb
aranha-0.2.1 lib/aranha/parsers/html/item_list.rb
aranha-0.2.0 lib/aranha/parsers/html/item_list.rb
aranha-0.1.0 lib/aranha/parsers/html/item_list.rb