class XmlHasher::Parser
Public Class Methods
new(options = {})
click to toggle source
# File lib/xmlhasher/parser.rb, line 6 def initialize(options = {}) @options = options end
Public Instance Methods
parse(xml)
click to toggle source
# File lib/xmlhasher/parser.rb, line 10 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 18 def convert(xml) xml.respond_to?(:read) || xml.respond_to?(:readpartial) ? xml : StringIO.new(xml) end