Module: BadBot::Detector
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/bad_bot/detector.rb
Overview
Detector Gives the controller the ability to detect and behave different for requests that come from search bots.
Example:
class ApplicationController < ...
include BadBot::Detector
end
...
<div>
<% no_bot do %>
stuff that is not worth to crawl
<% end %>
</div>
Instance Method Summary collapse
-
#is_bot? ⇒ Boolean
Public: Helper that returns true or false, if the the request if from a search bot or not.
-
#no_bot(&block) ⇒ Object
Public: Helper that only executes the block in case this is not a request made by a search bot.
Instance Method Details
#is_bot? ⇒ Boolean
Public: Helper that returns true or false, if the the request if from a search bot or not.
36 37 38 |
# File 'lib/bad_bot/detector.rb', line 36 def is_bot? @search_bot end |
#no_bot(&block) ⇒ Object
Public: Helper that only executes the block in case this is not a request made by a search bot
29 30 31 |
# File 'lib/bad_bot/detector.rb', line 29 def no_bot(&block) block.call unless(is_bot?) end |