Sha256: 6c5a8821177c4c1ede00a64daa18c4af6fe2643e092b2fdfd5518950fcb7e87a
Contents?: true
Size: 887 Bytes
Versions: 6
Compression:
Stored size: 887 Bytes
Contents
require 'active_model/serializer/adapter/fragment_cache' module ActiveModel class Serializer class Adapter class JsonApi < Adapter class FragmentCache def fragment_cache(root, cached_hash, non_cached_hash) hash = {} core_cached = cached_hash.first core_non_cached = non_cached_hash.first no_root_cache = cached_hash.delete_if {|key, value| key == core_cached[0] } no_root_non_cache = non_cached_hash.delete_if {|key, value| key == core_non_cached[0] } cached_resource = (core_cached[1]) ? core_cached[1].deep_merge(core_non_cached[1]) : core_non_cached[1] hash = (root) ? { root => cached_resource } : cached_resource hash.deep_merge no_root_non_cache.deep_merge no_root_cache end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems