Skip to content

Instantly share code, notes, and snippets.

@dhh
Created December 17, 2008 18:21
Show Gist options
  • Save dhh/37152 to your computer and use it in GitHub Desktop.
Save dhh/37152 to your computer and use it in GitHub Desktop.
class Poller < Rails::Metal
def process(env)
if env["PATH_INFO"] =~ /^\/poller_rack/
return [200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
end
end
end
# Implementation:
module Rails
class Metal
def initialize(app, *args)
@app = app; @args = args
end
def call(env)
if result = process(env)
result
else
@app.call(env)
end
end
def process(env)
false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment