Class: MediServ::API::Encoder
- Inherits:
-
Object
- Object
- MediServ::API::Encoder
- Defined in:
- lib/mediserv/api/encoder.rb
Instance Method Summary collapse
Instance Method Details
#build_tree(node, h) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mediserv/api/encoder.rb', line 9 def build_tree(node, h) h.each do |k, v| case v when Hash child = Node.new(name: [node.name, k].compact.join('.')) node.children << child build_tree(child, v) else node.attributes[k] = v end end node end |