Class: Rack::CrawlerDetect
- Inherits:
-
Object
- Object
- Rack::CrawlerDetect
- Defined in:
- lib/rack/crawler_detect.rb
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.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rack/crawler_detect.rb', line 5 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
18 19 20 21 22 |
# File 'lib/rack/crawler_detect.rb', line 18 def call(env) @env = env set_env_variables! @app.call(@env) end |