Sha256: 4b536e9f6070b132cc6ede993a6b4d74b253d4655acd4e4a0b1b447a69071c3b

Contents?: true

Size: 547 Bytes

Versions: 4

Compression:

Stored size: 547 Bytes

Contents

require 'delegate'
require 'dig_rb'
require 'forwardable'
require 'peddler/headers'
require 'multi_xml'

module Peddler
  # @api private
  class XMLParser < SimpleDelegator
    extend Forwardable
    include Headers

    def_delegator :parse, :dig

    def parse
      @data ||= find_data
    end

    def xml
      MultiXml.parse(body)
    end

    def valid?
      return unless headers['Content-Length']
      headers['Content-Length'].to_i == body.size
    end

    private

    def find_data
      raise NotImplementedError
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
peddler-1.6.3 lib/peddler/xml_parser.rb
peddler-1.6.2 lib/peddler/xml_parser.rb
peddler-1.6.1 lib/peddler/xml_parser.rb
peddler-1.6.0 lib/peddler/xml_parser.rb