Module: Taro::Rails::ActiveDeclarations

Included in:
Taro::Rails
Defined in:
lib/taro/rails/active_declarations.rb

Instance Method Summary collapse

Instance Method Details

#apply(declaration:, controller_class:, action_name:) ⇒ Object



2
3
4
5
6
# File 'lib/taro/rails/active_declarations.rb', line 2

def apply(declaration:, controller_class:, action_name:)
  Taro.declarations["#{controller_class.name}##{action_name}"] = declaration
  Taro::Rails::ParamParsing.install(controller_class:, action_name:)
  Taro::Rails::ResponseValidation.install(controller_class:)
end

#declaration_for(controller) ⇒ Object



8
9
10
# File 'lib/taro/rails/active_declarations.rb', line 8

def declaration_for(controller)
  Taro.declarations["#{controller.class.name}##{controller.action_name}"]
end