Class: Kaffe::Static

Inherits:
Object
  • Object
show all
Defined in:
lib/kaffe/static.rb

Instance Method Summary collapse

Constructor Details

#initialize(app = nil, path) ⇒ Static

Returns a new instance of Static.



3
4
5
6
# File 'lib/kaffe/static.rb', line 3

def initialize(app=nil, path)
  @app = app
  @files = Rack::File.new(path)
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/kaffe/static.rb', line 8

def call(env)
  res = @files.call(env)
  if res.first == 404 && @app
    res =@app.call(env)
  end

  res
end