Commit e55886b3 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Return `self` from `GroupChildSerializer#expand_hierarchy`

parent 9d1348d6
...@@ -6,10 +6,10 @@ class GroupChildSerializer < BaseSerializer ...@@ -6,10 +6,10 @@ class GroupChildSerializer < BaseSerializer
entity GroupChildEntity entity GroupChildEntity
def expand_hierarchy(hierarchy_root = nil) def expand_hierarchy(hierarchy_root = nil)
tap do
@hierarchy_root = hierarchy_root @hierarchy_root = hierarchy_root
@should_expand_hierarchy = true @should_expand_hierarchy = true
end
self
end end
def represent(resource, opts = {}, entity_class = nil) def represent(resource, opts = {}, entity_class = nil)
...@@ -41,7 +41,7 @@ class GroupChildSerializer < BaseSerializer ...@@ -41,7 +41,7 @@ class GroupChildSerializer < BaseSerializer
.merge(children: Array.wrap(serializer.represent_hierarchy(children, opts))) .merge(children: Array.wrap(serializer.represent_hierarchy(children, opts)))
end end
elsif hierarchy.is_a?(Array) elsif hierarchy.is_a?(Array)
hierarchy.map { |child| serializer.represent_hierarchy(child, opts) }.flatten hierarchy.flat_map { |child| serializer.represent_hierarchy(child, opts) }
else else
serializer.represent(hierarchy, opts) serializer.represent(hierarchy, opts)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment