Class: Rack::Obama

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-obama/obama.rb,
lib/rack-obama/version.rb

Constant Summary collapse

CONTENT_TYPE =
"nobel-prize/peace".freeze
VERSION =
"0.1.1".freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Obama

Returns a new instance of Obama.



9
10
11
# File 'lib/rack-obama/obama.rb', line 9

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rack-obama/obama.rb', line 13

def call(env)
  if env["CONTENT_TYPE"] == CONTENT_TYPE
    ["202 Accepted", {"Content-Type" => CONTENT_TYPE, "Content-Length" => "0"}, []]
  else
    @app.call(env)
  end
end