class LHC::Interceptors

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/lhc/interceptors.rbs

class LHC::Interceptors
  def initialize: (LHC::Request request) -> void
  def intercept: (Symbol name) -> Array[]
end

Represents all active interceptors for a request/response.
Handles interceptions during the lifecycle of a request

def initialize(request)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (LHC::Request request) -> void

This signature was generated using 37 samples from 1 application.

Intitalizes and determines if global or local interceptors are used
def initialize(request)
  self.all = (request.options[:interceptors] || LHC.config.interceptors).map do |interceptor|
    interceptor.new(request)
  end
end

def intercept(name)

Experimental RBS support (using type sampling data from the type_fusion project).

def intercept: (Symbol name) ->

This signature was generated using 188 samples from 4 applications.

Forwards messages to interceptors and handles provided responses.
def intercept(name)
  all.each do |interceptor|
    result = interceptor.send(name)
    if result.is_a? LHC::Response
      raise 'Response already set from another interceptor' if @response
      @response = interceptor.request.response = result
    end
  end
end