Module: ActionFigure::Core

Defined in:
lib/action_figure/core.rb,
sig/action_figure.rbs

Overview

Validation pipeline and DSL mixed into action classes

Defined Under Namespace

Modules: ClassMethods, CrossParamRuleHelpers, Notifications

Instance Method Summary collapse

Instance Method Details

#contractObject

Returns:

  • (Object)


151
152
153
# File 'lib/action_figure/core.rb', line 151

def contract
  self.class.contract
end

#entry_point_nameSymbol?

Returns:

  • (Symbol, nil)


147
148
149
# File 'lib/action_figure/core.rb', line 147

def entry_point_name
  self.class.entry_point_name
end

#validated_call(**kwargs) ⇒ ActionFigure::response

Parameters:

  • kwargs (Object)

Returns:

  • (ActionFigure::response)


155
156
157
158
159
160
161
162
163
# File 'lib/action_figure/core.rb', line 155

def validated_call(**kwargs)
  kwargs = normalize_params(kwargs)

  if contract && kwargs.key?(:params)
    validate_and_call(**kwargs)
  else
    public_send(entry_point_name, **kwargs)
  end
end