class Gruf::Hooks::Executor

Base class for a hook that allows execution at various points of gRPC server processes

Public Class Methods

new(hooks: nil) click to toggle source
# File lib/gruf/hooks/executor.rb, line 26
def initialize(hooks: nil)
  @hooks = hooks || Gruf.hooks&.prepare || []
end

Public Instance Methods

call(name, arguments = {}) click to toggle source

Execute a hook point for each registered hook in the registry

@param [Symbol] name @param [Hash] arguments

# File lib/gruf/hooks/executor.rb, line 36
def call(name, arguments = {})
  name = name.to_sym

  @hooks.each do |hook|
    next unless hook.respond_to?(name)

    hook.send(name, **arguments)
  end
end