Class: Simple::Httpd::Rack::Merger
- Inherits:
-
Object
- Object
- Simple::Httpd::Rack::Merger
- Defined in:
- lib/simple/httpd/rack/merger.rb
Overview
A simple file server middleware
Constant Summary collapse
- Rack =
Simple::Httpd::Rack
Class Method Summary collapse
-
.build(apps) ⇒ Object
returns an app that merges other apps.
Instance Method Summary collapse
Class Method Details
.build(apps) ⇒ Object
returns an app that merges other apps
6 7 8 9 10 |
# File 'lib/simple/httpd/rack/merger.rb', line 6 def self.build(apps) return apps.first if apps.length == 1 new(apps) end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/simple/httpd/rack/merger.rb', line 20 def call(env) @apps.each do |app| status, body, headers = app.call(env) return [status, body, headers] unless status == 404 end Rack.error 404, "No such action" end |