class XTJ::Document
Public Class Methods
new(xml_document)
click to toggle source
# File lib/xtj.rb, line 15 def initialize(xml_document) @document = xml_document end
Public Instance Methods
to_hash()
click to toggle source
# File lib/xtj.rb, line 20 def to_hash @to_hash ||= parse end
to_json(*_args)
click to toggle source
# File lib/xtj.rb, line 25 def to_json(*_args) to_hash.to_json end
Private Instance Methods
parse()
click to toggle source
# File lib/xtj.rb, line 32 def parse parser = REXML::Parsers::SAX2Parser.new(@document) handler = Handlers::XMLHandler.new parser.listen(handler) parser.parse handler.xml_hash end