Class: Rack::HalfPipe
- Inherits:
-
Object
- Object
- Rack::HalfPipe
- Defined in:
- lib/rack/half-pipe.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ HalfPipe
constructor
A new instance of HalfPipe.
Constructor Details
#initialize(app) ⇒ HalfPipe
Returns a new instance of HalfPipe.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/half-pipe.rb', line 7 def initialize(app) @compilers = [] @compilers << Rack::AssetCompiler.new(app, scripts_config) @compilers << Rack::AssetCompiler.new(app, bower_js_config) @compilers << Rack::AssetCompiler.new(app, bower_css_config) @compilers << Rack::AssetCompiler.new(app, images_config) @compilers << Rack::SassCompiler.new(app, sass_config) @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rack/half-pipe.rb', line 19 def call(env) res = @compilers.reduce([404]) do |memo,compiler| if memo[0] == 404 compiler.call(env) else memo end end if res[0] == 404 @app.call(env) else res end end |