Class: JsonapiCompliable::Util::IncludeParams

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi_compliable/util/include_params.rb

Class Method Summary collapse

Class Method Details

.scrub(requested_includes, allowed_includes) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/jsonapi_compliable/util/include_params.rb', line 5

def scrub(requested_includes, allowed_includes)
  {}.tap do |valid|
    requested_includes.each_pair do |key, sub_hash|
      if allowed_includes[key]
        valid[key] = scrub(sub_hash, allowed_includes[key])
      end
    end
  end
end