lib/aigu/ember_importer.rb in aigu-0.5 vs lib/aigu/ember_importer.rb in aigu-0.5.1
- old
+ new
@@ -35,18 +35,23 @@
def build_blob
@blob = Hash.recursive
@object.each_pair do |key, value|
parts = key.split('.')
- hash = @blob[parts.first]
- parts.each_with_index do |part, index|
- next if index.zero?
+ if parts.length == 1
+ @blob[parts.first] = value
+ else
+ hash = @blob[parts.first]
- if index + 1 < parts.length
- hash = hash[part]
- else
- hash[part] = value
+ parts.each_with_index do |part, index|
+ next if index.zero?
+
+ if index + 1 < parts.length
+ hash = hash[part]
+ else
+ hash[part] = value
+ end
end
end
end
end
end