Module: IsBot

Defined in:
lib/isbot.rb

Class Method Summary collapse

Class Method Details

.add_ua_field(user_agent_field) ⇒ Object



21
22
23
24
# File 'lib/isbot.rb', line 21

def IsBot.add_ua_field(user_agent_field)
  IsBotParser::PATTERN_LIST.push user_agent_field
  $init = false
end

.regexObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/isbot.rb', line 8

def IsBot.regex
  unless $init
    list = IsBotParser::parse
    list.each_with_index do |item, i|
      $regex_str += "(#{item})"
      $regex_str += '|' if i < (list.length - 1)
    end
    $init = true
    $regex = /#{$regex_str}/i
  end
  $regex
end