Sha256: 498a9f557cd0d9b1c602aa23859ee32ba9c81b1fd3af6f089b5714fffc817702

Contents?: true

Size: 405 Bytes

Versions: 11

Compression:

Stored size: 405 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
      fail NotImplementedError
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
peddler-1.3.0 lib/peddler/xml_parser.rb
peddler-1.2.0 lib/peddler/xml_parser.rb
peddler-1.1.1 lib/peddler/xml_parser.rb
peddler-1.1.0 lib/peddler/xml_parser.rb
peddler-1.0.2 lib/peddler/xml_parser.rb
peddler-1.0.1 lib/peddler/xml_parser.rb
peddler-1.0.0 lib/peddler/xml_parser.rb
peddler-0.19.0 lib/peddler/xml_parser.rb
peddler-0.18.0 lib/peddler/xml_parser.rb
peddler-0.17.1 lib/peddler/xml_parser.rb
peddler-0.17.0 lib/peddler/xml_parser.rb