Class: LolSoap::HashBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/lolsoap/hash_builder.rb

Overview

Turns an XML node into a hash data structure. Works out which elements are supposed to be collections based on the type information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, type) ⇒ HashBuilder

Returns a new instance of HashBuilder.



7
8
9
10
# File 'lib/lolsoap/hash_builder.rb', line 7

def initialize(node, type)
  @node = node
  @type = type
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



5
6
7
# File 'lib/lolsoap/hash_builder.rb', line 5

def node
  @node
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/lolsoap/hash_builder.rb', line 5

def type
  @type
end

Instance Method Details

#outputObject



12
13
14
15
16
17
18
# File 'lib/lolsoap/hash_builder.rb', line 12

def output
  if node.first_element_child
    children_hash
  else
    content
  end
end