Class: AssetServer

Inherits:
Object show all
Defined in:
lib/laris/asset_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ AssetServer

Returns a new instance of AssetServer.



4
5
6
7
# File 'lib/laris/asset_server.rb', line 4

def initialize(app)
  @app = app
  @res = Rack::Response.new
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



2
3
4
# File 'lib/laris/asset_server.rb', line 2

def app
  @app
end

#resObject (readonly)

Returns the value of attribute res.



2
3
4
# File 'lib/laris/asset_server.rb', line 2

def res
  @res
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/laris/asset_server.rb', line 9

def call(env)
  req = Rack::Request.new(env)
  if req.path =~ (/^\/assets/)
    respond_with_asset(req)
  else
    app.call(env)
  end
end