Sha256: b52eeb1f31060a71e4e6c160df8fed1511953f2888b4b8e480b54c055b365f44

Contents?: true

Size: 390 Bytes

Versions: 13

Compression:

Stored size: 390 Bytes

Contents

require 'stringio'

module XmlHasher
  class Parser

    def initialize(options = {})
      @options = options
    end

    def parse(xml)
      handler = Handler.new(@options)
      Ox.sax_parse(handler, convert(xml))
      handler.to_hash
    end

    private

    def convert(xml)
      xml.respond_to?(:read) || xml.respond_to?(:readpartial) ? xml : StringIO.new(xml)
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
xmlhasher_with_attributes-1.0.1 lib/xmlhasher/parser.rb
xmlhasher_with_attributes-1.0.0 lib/xmlhasher/parser.rb
xmlhasher-1.0.4 lib/xmlhasher/parser.rb
xmlhasher-1.0.3 lib/xmlhasher/parser.rb
xmlhasher-1.0.2 lib/xmlhasher/parser.rb
xmlhasher-1.0.1 lib/xmlhasher/parser.rb
xmlhasher-1.0.0 lib/xmlhasher/parser.rb
xmlhasher-0.0.6 lib/xmlhasher/parser.rb
xmlhasher-0.0.5 lib/xmlhasher/parser.rb
xmlhasher-0.0.4 lib/xmlhasher/parser.rb
xmlhasher-0.0.3 lib/xmlhasher/parser.rb
xmlhasher-0.0.2 lib/xmlhasher/parser.rb
xmlhasher-0.0.1 lib/xmlhasher/parser.rb