Sha256: b3f8b72b34739bafec92a08ab913f0a4097a643b9ae4bf73bddebdfa160add42

Contents?: true

Size: 406 Bytes

Versions: 3

Compression:

Stored size: 406 Bytes

Contents

require 'delegate'
require 'multi_xml'

module Peddler
  # @api private
  class XMLParser < SimpleDelegator
    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

3 entries across 3 versions & 1 rubygems

Version Path
peddler-1.5.0 lib/peddler/xml_parser.rb
peddler-1.4.1 lib/peddler/xml_parser.rb
peddler-1.4.0 lib/peddler/xml_parser.rb