Class: Rack::EvilRobot
- Inherits:
-
Object
- Object
- Rack::EvilRobot
- Defined in:
- lib/rack/evil_robot.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ EvilRobot
constructor
A new instance of EvilRobot.
Constructor Details
#initialize(app, options = {}) ⇒ EvilRobot
Returns a new instance of EvilRobot.
3 4 5 6 |
# File 'lib/rack/evil_robot.rb', line 3 def initialize(app, = {}) @app = app @redirect_path = [:redirect_path] || 'http://www.example.com/' end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rack/evil_robot.rb', line 8 def call(env) if evil_robot?(env) goodbye else if env['PATH_INFO'] =~ /honey_pot/ [200, {'Content-Type' => 'text/html'}, ['Mmmm Honey...']] else @app.call(env) end end end |