Sha256: 57ad7f8e1c25842aaa51847eacdf31303880f4d0a15f6b8bc344ac9f10197050

Contents?: true

Size: 682 Bytes

Versions: 9

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

class DHC::Interceptor

  attr_reader :request

  def initialize(request)
    @request = request
  end

  def response
    @request.response
  end

  def before_init; end

  def before_request; end

  def after_request; end

  def before_response; end

  def after_response; end

  # Prevent Interceptors from beeing duplicated!
  # Their classes have flag-character.
  # When duplicated you can't check for their class name anymore:
  # e.g. options.deep_dup[:interceptors].include?(DHC::Caching) # false
  def self.dup
    self
  end

  def all_interceptor_classes
    @all_interceptors ||= DHC::Interceptors.new(request).all.map(&:class)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dhc-3.0.0 lib/dhc/interceptor.rb
dhc-2.4.0 lib/dhc/interceptor.rb
dhc-2.3.0 lib/dhc/interceptor.rb
dhc-2.2.1 lib/dhc/interceptor.rb
dhc-2.2.0 lib/dhc/interceptor.rb
dhc-2.1.1 lib/dhc/interceptor.rb
dhc-2.1.0 lib/dhc/interceptor.rb
dhc-2.0.1 lib/dhc/interceptor.rb
dhc-2.0.0 lib/dhc/interceptor.rb