Class: BreezyPDF::Interceptor

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

Overview

Intercept a Rack request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Interceptor

Returns a new instance of Interceptor.


8
9
10
11
# File 'lib/breezy_pdf/interceptor.rb', line 8

def initialize(app, env)
  @app = app
  @env = env
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app


6
7
8
# File 'lib/breezy_pdf/interceptor.rb', line 6

def app
  @app
end

#envObject (readonly)

Returns the value of attribute env


6
7
8
# File 'lib/breezy_pdf/interceptor.rb', line 6

def env
  @env
end

Instance Method Details

#intercept!Object


13
14
15
16
17
18
19
20
# File 'lib/breezy_pdf/interceptor.rb', line 13

def intercept!
  if intercept?
    BreezyPDF.logger.info("[BreezyPDF] Intercepting request for PDF rendering")
    intercept.new(@app, @env).call
  else
    app.call(env)
  end
end