Class: Rack::Refresher

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

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Constructor Details

#initialize(app) {|@config| ... } ⇒ Refresher

Returns a new instance of Refresher.

Yields:

  • (@config)


17
18
19
20
21
22
# File 'lib/rack/refresher.rb', line 17

def initialize(app)
  @app    = app
  @config = Config.new
  @mark   = rand(Time.now.to_i)
  yield(@config) if block_given?
end

Instance Method Details

#call(env) ⇒ Object



24
25
26
27
# File 'lib/rack/refresher.rb', line 24

def call(env)
  status, headers, body = @app.call(env)
  Response.new(inject(body), status, headers)
end