Class: Rack::NonCache::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/noncache/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend, options) {|_self| ... } ⇒ Engine

Returns a new instance of Engine.

Yields:

  • (_self)

Yield Parameters:



8
9
10
11
12
13
# File 'lib/rack/noncache/engine.rb', line 8

def initialize(backend, options)
  @backend = backend
  @whitelist = options[:whitelist]
  @blacklist = options[:blacklist]
  yield self if block_given?
end

Instance Attribute Details

#blacklistObject

Returns the value of attribute blacklist.



6
7
8
# File 'lib/rack/noncache/engine.rb', line 6

def blacklist
  @blacklist
end

#whitelistObject

Returns the value of attribute whitelist.



6
7
8
# File 'lib/rack/noncache/engine.rb', line 6

def whitelist
  @whitelist
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/rack/noncache/engine.rb', line 15

def call(env)
  # execute the request using our backend
  status, headers, response = @backend.call(env)

  uri = env['REQUEST_URI']
  filters.each { |filter| filter.apply(headers) } if target_path? uri
  [status, headers, response]
end