Class: ThriftRack::Ping

Inherits:
Object
  • Object
show all
Defined in:
lib/thrift_rack/ping.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Ping

Returns a new instance of Ping.



3
4
5
# File 'lib/thrift_rack/ping.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
# File 'lib/thrift_rack/ping.rb', line 7

def call(env)
  req = Rack::Request.new(env)
  return Rack::Response.new(["PONG"], 200, {'Content-Type' => 'text/plain'}) if req.path == "/ping"
  @app.call(env)
end