Class: Rack::Pot

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

Constant Summary collapse

CONTENT_TYPE =
"application/coffee-pot-command".freeze
VERSION =
"0.1.0".freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Pot

Returns a new instance of Pot.



9
10
11
# File 'lib/rack-pot/pot.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-pot/pot.rb', line 13

def call(env)
  if env["CONTENT_TYPE"] == CONTENT_TYPE
    ["418 I'm a teapot", {"Content-Type" => CONTENT_TYPE, "Content-Length" => "0"}, []]
  else
    @app.call(env)
  end
end