Class: Appetizer::UI::Assets::Delivery
- Inherits:
-
Struct
- Object
- Struct
- Appetizer::UI::Assets::Delivery
- Defined in:
- lib/appetizer/ui/assets/delivery.rb
Constant Summary collapse
- STATIC =
{ root: "public", urls: Dir["public/*"].map { |s| s[6..-1] } }
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app
4 5 6 |
# File 'lib/appetizer/ui/assets/delivery.rb', line 4 def app @app end |
Instance Method Details
#asset(env) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/appetizer/ui/assets/delivery.rb', line 16 def asset env if !Assets.compiled? and env["PATH_INFO"].start_with? "/assets" env["PATH_INFO"] = env["PATH_INFO"][7..-1] App.assets.call env end end |
#cached(env) ⇒ Object
23 24 25 |
# File 'lib/appetizer/ui/assets/delivery.rb', line 23 def cached env Rack::StaticCache.new(app, STATIC).call env if Assets.compiled? end |
#call(env) ⇒ Object
12 13 14 |
# File 'lib/appetizer/ui/assets/delivery.rb', line 12 def call env cached(env) || asset(env) || app.call(env) end |