Class: AssetServer
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#res ⇒ Object
readonly
Returns the value of attribute res.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ AssetServer
constructor
A new instance of AssetServer.
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
#app ⇒ Object (readonly)
Returns the value of attribute app.
2 3 4 |
# File 'lib/laris/asset_server.rb', line 2 def app @app end |
#res ⇒ Object (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 |