Module: Exlibris::Primo::XmlUtil

Overview

Utility for parsing and building XML

Defined Under Namespace

Modules: ClassAttributes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



9
10
11
12
13
# File 'lib/exlibris/primo/xml_util.rb', line 9

def self.included(klass)
  klass.class_eval do
    extend ClassAttributes
  end
end

Instance Method Details

#to_hashObject



50
51
52
# File 'lib/exlibris/primo/xml_util.rb', line 50

def to_hash
  Hash.from_xml(to_xml)
end

#to_jsonObject



58
59
60
# File 'lib/exlibris/primo/xml_util.rb', line 58

def to_json
  to_hash.to_json
end

#to_xmlObject



54
55
56
# File 'lib/exlibris/primo/xml_util.rb', line 54

def to_xml
  xml.to_xml(xml_options).strip
end