Created
December 17, 2008 18:21
-
-
Save dhh/37152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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