Class: StaticAssetsServer
- Inherits:
-
Object
- Object
- StaticAssetsServer
- Defined in:
- lib/asset_server.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#req ⇒ Object
readonly
Returns the value of attribute req.
-
#res ⇒ Object
readonly
Returns the value of attribute res.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ StaticAssetsServer
constructor
A new instance of StaticAssetsServer.
Constructor Details
#initialize(app) ⇒ StaticAssetsServer
Returns a new instance of StaticAssetsServer.
4 5 6 7 |
# File 'lib/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/asset_server.rb', line 2 def app @app end |
#req ⇒ Object (readonly)
Returns the value of attribute req.
2 3 4 |
# File 'lib/asset_server.rb', line 2 def req @req end |
#res ⇒ Object (readonly)
Returns the value of attribute res.
2 3 4 |
# File 'lib/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/asset_server.rb', line 9 def call(env) @req = Rack::Request.new(env) if req.path =~ /^\/public\/assets/ serve_asset else app.call(env) end end |