tree_decorator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/tree_decorator/object_hanger.rb +5 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -20,15 +20,14 @@ module TreeDecorator
|
|
20
20
|
|
21
21
|
private
|
22
22
|
def get_hash_from_objects
|
23
|
-
|
24
|
-
|
25
|
-
return content
|
23
|
+
objects = @root.kind_of?(Array) ? @root : [@root]
|
24
|
+
populate_with_children(objects)
|
26
25
|
end
|
27
26
|
|
28
27
|
def populate_with_children(object)
|
29
|
-
content = Hash.new
|
30
|
-
children = object.send(children_method)
|
31
|
-
|
28
|
+
content = Hash.new
|
29
|
+
children = object.kind_of?(Array) ? object : object.send(children_method)
|
30
|
+
|
32
31
|
if children and !children.empty?
|
33
32
|
children.each do |child|
|
34
33
|
content[child.send(content_method)] = populate_with_children(child)
|