Class: Bowtie::Middleware::Static

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

Instance Method Summary collapse

Constructor Details

#initialize(app, options) ⇒ Static

Returns a new instance of Static.



3
4
5
6
7
# File 'lib/bowtie/middleware/static.rb', line 3

def initialize(app, options)
  @app         = app
  @options     = options
  @rack_static = Rack::Static.new(app, options)
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/bowtie/middleware/static.rb', line 9

def call(env)
  status, response, headers = @rack_static.call(env)
  status = status.to_i

  if status != 200 && !status.between?(300, 399)
    return @app.call(env)
  else
    [status, response, headers]
  end
end