class Rack::Builder
def run(app = nil, &block)
run Heartbeat.new
end
end
[200, { "content-type" => "text/plain" }, ["OK"]]
def call(env)
class Heartbeat
You can also provide a class instance:
run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] }
You can also provide a lambda:
end
[200, { "content-type" => "text/plain" }, ["Hello World!"]]
run do |env|
You can use a block:
returns a Rack response.
Takes a block or argument that is an object that responds to #call and
def run(app = nil, &block) raise ArgumentError, "Both app and block given!" if app && block_given? @run = app || block end