Class: BadBot::Bots
Overview
Bots list
Instance Method Summary collapse
-
#bots ⇒ Object
Public: Returns the array of bots.
-
#bots_to_regexp ⇒ Object
Public: Convert the array of bots into a regular expression for searching.
-
#initialize ⇒ Bots
constructor
A new instance of Bots.
-
#setup {|@bots| ... } ⇒ Object
Public: Configures the search robots array: Example BadBot.Bot.insance.setup do |bots| bots << ‘googlebot’ bots << ‘yahoo’ bots << ‘custom stuff’ end.
Constructor Details
#initialize ⇒ Bots
Returns a new instance of Bots.
10 11 12 |
# File 'lib/bad_bot/bots.rb', line 10 def initialize @bots = ['msnbot', 'googlebot', 'slurp', 'yahoo'] end |
Instance Method Details
#bots ⇒ Object
Public: Returns the array of bots
28 29 30 |
# File 'lib/bad_bot/bots.rb', line 28 def bots @bots end |
#bots_to_regexp ⇒ Object
Public: Convert the array of bots into a regular expression for searching
34 35 36 |
# File 'lib/bad_bot/bots.rb', line 34 def bots_to_regexp Regexp.union(bots) end |
#setup {|@bots| ... } ⇒ Object
Public: Configures the search robots array: Example
BadBot.Bot.insance.setup do |bots|
bots << 'googlebot'
bots << 'yahoo'
bots << 'custom stuff'
end
22 23 24 |
# File 'lib/bad_bot/bots.rb', line 22 def setup yield(@bots) end |