Module: Grape::DSL::InsideRoute::PostBeforeFilter

Defined in:
lib/grape/dsl/inside_route.rb

Overview

Methods which should not be available in filters until the before filter has completed

Instance Method Summary collapse

Instance Method Details

#declared(passed_params, options = {}, declared_params = nil, params_nested_path = []) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/grape/dsl/inside_route.rb', line 28

def declared(passed_params, options = {}, declared_params = nil, params_nested_path = [])
  options = options.reverse_merge(include_missing: true, include_parent_namespaces: true, evaluate_given: false)
  declared_params ||= optioned_declared_params(**options)

  res = if passed_params.is_a?(Array)
          declared_array(passed_params, options, declared_params, params_nested_path)
        else
          declared_hash(passed_params, options, declared_params, params_nested_path)
        end

  if (key_maps = namespace_stackable(:contract_key_map))
    key_maps.each { |key_map| key_map.write(passed_params, res) }
  end

  res
end