Class: BotChecker::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/bot_checker/checker.rb

Instance Method Summary collapse

Instance Method Details

#bot?(user_agent = nil) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
# File 'lib/bot_checker/checker.rb', line 3

def bot?(user_agent = nil)
  return false if user_agent.nil?

  bot_list = BotChecker::Lister.new

  WILD_CARDS.any? { |wc| user_agent.downcase.include?(wc) } || bot_list.include?(user_agent)
end