Sha256: b4dc98d2139751261cec3cfa8dde0fb55776a4a8608a30644f68014665b8a6be

Contents?: true

Size: 691 Bytes

Versions: 75

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/html/base'

module Aranha
  module Parsers
    module Html
      class ItemList < Base
        def data
          items_data
        end

        def item_data(item)
          item
        end

        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

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

Version data entries

75 entries across 75 versions & 2 rubygems

Version Path
aranha-parsers-0.24.0 lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.23.1 lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.23.0 lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.22.0 lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.21.0 lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.20.0 lib/aranha/parsers/html/item_list.rb
eac_tools-0.69.1 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.19.1 lib/aranha/parsers/html/item_list.rb
eac_tools-0.69.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.68.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.19.0 lib/aranha/parsers/html/item_list.rb
eac_tools-0.67.1 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.67.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.66.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.65.1 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
aranha-parsers-0.18.0 lib/aranha/parsers/html/item_list.rb
eac_tools-0.65.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.64.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.63.0 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb
eac_tools-0.62.1 sub/aranha-parsers/lib/aranha/parsers/html/item_list.rb