module ActiveModel::Serializer::IncludeTree::Parsing
def include_string_to_hash(included)
-
(Hash)
- a Hash representing the same tree structure
Parameters:
-
included
(String
) --
def include_string_to_hash(included) # TODO: Needs comment walking through the process of what all this is doing. included.delete(' ').split(',').reduce({}) do |hash, path| include_tree = path.split('.').reverse_each.reduce({}) { |a, e| { e.to_sym => a } } hash.deep_merge!(include_tree) end end