class XmlHasher::Parser

Public Class Methods

new(options = {}) click to toggle source
# File lib/xmlhasher/parser.rb, line 7
def initialize(options = {})
  @options = options
end

Public Instance Methods

parse(xml) click to toggle source
# File lib/xmlhasher/parser.rb, line 11
def parse(xml)
  handler = Handler.new(@options)
  Ox.sax_parse(handler, convert(xml))
  handler.to_hash
end

Private Instance Methods

convert(xml) click to toggle source
# File lib/xmlhasher/parser.rb, line 19
def convert(xml)
  xml.respond_to?(:read) || xml.respond_to?(:readpartial) ? xml : StringIO.new(xml)
end