Class: Rails::Offline

Inherits:
Rack::Offline show all
Defined in:
lib/rack-offline.rb

Constant Summary

Constants inherited from Rack::Offline

Rack::Offline::UNCACHED_KEY_INTERVAL, Rack::Offline::VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rack::Offline

#call, configure

Constructor Details

#initialize(options = {}, app = Rails.application, &block) ⇒ Offline

Returns a new instance of Offline.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rack-offline.rb', line 10

def initialize(options = {}, app = Rails.application, &block)
  config = app.config
  root   = config.paths['public'].first
  block  = cache_block(Pathname.new(root)) unless block_given?

  opts = {
    :cache  => config.cache_classes,
    :root   => root,
    :logger => Rails.logger
  }.merge(options)

  super(opts, &block)
end

Class Method Details

.call(env) ⇒ Object



5
6
7
8
# File 'lib/rack-offline.rb', line 5

def self.call(env)
  @app ||= new
  @app.call(env)
end