Module: VantivLite::XML

Defined in:
lib/vantiv_lite/xml.rb,
lib/vantiv_lite/xml/ox.rb,
lib/vantiv_lite/xml/rexml.rb,
lib/vantiv_lite/xml/parser.rb,
lib/vantiv_lite/xml/nokogiri.rb,
lib/vantiv_lite/xml/serializer.rb

Defined Under Namespace

Modules: Nokogiri, Ox, Parser, REXML, Serializer

Class Method Summary collapse

Class Method Details

.hash_or_array(obj) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/vantiv_lite/xml.rb', line 9

def hash_or_array(obj)
  case obj
  when Hash
    yield(obj)
  when Array
    obj.map { |o| yield(o) }
  else
    obj
  end
end

.parser_with(name) ⇒ Object



20
21
22
# File 'lib/vantiv_lite/xml.rb', line 20

def parser_with(name)
  const_get(name)::Parser.new
end

.serializer_with(name, attributes: Serializer::ATTRIBUTES) ⇒ Object



24
25
26
# File 'lib/vantiv_lite/xml.rb', line 24

def serializer_with(name, attributes: Serializer::ATTRIBUTES)
  const_get(name)::Serializer.new(attributes: attributes)
end