Class: Rack::CrawlerDetect
- Inherits:
-
Object
- Object
- Rack::CrawlerDetect
- Defined in:
- lib/rack/crawler_detect.rb
Overview
Rack-based interface to detect crawlers
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ CrawlerDetect
constructor
A new instance of CrawlerDetect.
Constructor Details
#initialize(app, options = {}) ⇒ CrawlerDetect
Returns a new instance of CrawlerDetect.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rack/crawler_detect.rb', line 8 def initialize(app, = {}) Rack::Request::Helpers.module_eval do def is_crawler? env["rack.crawler_detect"][:is_crawler] end def crawler_name env["rack.crawler_detect"][:crawler_name] end end @app = app end |
Instance Method Details
#call(env) ⇒ Object
21 22 23 24 |
# File 'lib/rack/crawler_detect.rb', line 21 def call(env) set_env_variables!(env) @app.call(env) end |