Class: Rack::CacheSmash

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-cache-smash.rb,
lib/rack-cache-smash/version.rb

Constant Summary collapse

VERSION =
'1.0.0'

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CacheSmash

Returns a new instance of CacheSmash.



6
7
8
# File 'lib/rack-cache-smash.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rack-cache-smash.rb', line 10

def call(env)
  response = @app.call(env)
  headers = response[1]
  return response unless html_response?(headers)

  status = response.first
  original_body_arr = response.last
  body_str = cache_bust_asset_paths_in_body(original_body_arr)
  return [status, headers, [body_str]]
end