Class: BadBot::Bots

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/bad_bot/bots.rb

Overview

Bots list

Instance Method Summary collapse

Constructor Details

#initializeBots

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

#botsObject

Public: Returns the array of bots



28
29
30
# File 'lib/bad_bot/bots.rb', line 28

def bots
  @bots
end

#bots_to_regexpObject

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

Yields:



22
23
24
# File 'lib/bad_bot/bots.rb', line 22

def setup
  yield(@bots)
end