15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/y_fantasy/concerns/subresourceable.rb', line 15
def add_fetched_subresources(subresources = [])
Transformations::T.wrap_in_array(subresources).each do |subresource|
case subresource
when Symbol
fetched_subresources << subresource
when Hash
key = subresource.keys.first
fetched_subresources << key
sub_instances = Transformations::T.wrap_in_array(send(key))
sub_instances&.each do |sub_instance|
sub_instance.add_fetched_subresources(subresource[key])
end
end
end
end
|