Class: LHC::Interceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/lhc/interceptor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Interceptor

Returns a new instance of Interceptor.



7
8
9
# File 'lib/lhc/interceptor.rb', line 7

def initialize(request)
  @request = request
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'lib/lhc/interceptor.rb', line 5

def request
  @request
end

Class Method Details

.dupObject

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.include?(LHC::Caching) # false



29
30
31
# File 'lib/lhc/interceptor.rb', line 29

def self.dup
  self
end

Instance Method Details

#after_requestObject



19
# File 'lib/lhc/interceptor.rb', line 19

def after_request; end

#after_responseObject



23
# File 'lib/lhc/interceptor.rb', line 23

def after_response; end

#all_interceptor_classesObject



33
34
35
# File 'lib/lhc/interceptor.rb', line 33

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

#before_raw_requestObject



15
# File 'lib/lhc/interceptor.rb', line 15

def before_raw_request; end

#before_requestObject



17
# File 'lib/lhc/interceptor.rb', line 17

def before_request; end

#before_responseObject



21
# File 'lib/lhc/interceptor.rb', line 21

def before_response; end

#responseObject



11
12
13
# File 'lib/lhc/interceptor.rb', line 11

def response
  @request.response
end