Class: ActionParamsPermitter::PermitProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/action_params_permitter/permit_processor.rb

Overview

Makes permitting process. It can be done using income params from your controller and builded permitter

Parameters: params - instance of ActionController::Parameters builder - instance of Builders::Main

Returns: hash with permitted parameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, builder) ⇒ PermitProcessor

Returns a new instance of PermitProcessor.



21
22
23
# File 'lib/action_params_permitter/permit_processor.rb', line 21

def initialize(params, builder)
  @params, @builder = params, builder
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



17
18
19
# File 'lib/action_params_permitter/permit_processor.rb', line 17

def builder
  @builder
end

#paramsObject (readonly)

Returns the value of attribute params.



17
18
19
# File 'lib/action_params_permitter/permit_processor.rb', line 17

def params
  @params
end

Instance Method Details

#callObject



25
26
27
# File 'lib/action_params_permitter/permit_processor.rb', line 25

def call
  top_is_required? ? make_requiring : make_permitting
end