Class: GraphqlRails::Controller::ActionHooksRunner
- Inherits:
-
Object
- Object
- GraphqlRails::Controller::ActionHooksRunner
- Defined in:
- lib/graphql_rails/controller/action_hooks_runner.rb
Overview
runs before/around/after_action controller hooks
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(action_name:, controller:) ⇒ ActionHooksRunner
constructor
A new instance of ActionHooksRunner.
Constructor Details
#initialize(action_name:, controller:) ⇒ ActionHooksRunner
Returns a new instance of ActionHooksRunner.
7 8 9 10 |
# File 'lib/graphql_rails/controller/action_hooks_runner.rb', line 7 def initialize(action_name:, controller:) @action_name = action_name @controller = controller end |
Instance Method Details
#call(&block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/graphql_rails/controller/action_hooks_runner.rb', line 12 def call(&block) result = nil run_action_hooks(:before) run_around_action_hooks { result = controller.instance_exec(&block) } run_action_hooks(:after) result end |