Class: Gnarly::System

Inherits:
Object
  • Object
show all
Defined in:
lib/gnarly/system.rb

Instance Method Summary collapse

Constructor Details

#initialize(*apps) ⇒ System

Returns a new instance of System.



6
7
8
# File 'lib/gnarly/system.rb', line 6

def initialize(*apps)
  @apps = apps
end

Instance Method Details

#+(app) ⇒ Object



10
11
12
13
# File 'lib/gnarly/system.rb', line 10

def +(app)
  @apps << app
  self
end

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/gnarly/system.rb', line 15

def call(env)
  response = nil
  @apps.find do |app|
    response = app.call(env)
    status = response.first
    status != 404 and status < 500
  end
  response
end