class UserAgent::Browsers::Base

def bot?

def bot?
  # If UA has no application type, its probably generated by a
  # shitty bot.
  if application.nil?
    true
  # Match common case when bots refer to themselves as bots in
  # the application comment. There are no standards for how bots
  # should call themselves so its not an exhaustive method.
  #
  # If you want to expand the scope, override the method and
  # provide your own regexp. Any patches to future extend this
  # list will be rejected.
  elsif detect_comment_match(/bot/i)
    true
  # Google PageSpeed Insights adds "Chrome-Lighthouse" to the user agent
  # https://stackoverflow.com/questions/16403295/what-is-the-name-of-the-google-pagespeed-user-agent
  elsif detect_product("Chrome-Lighthouse")
    true
  elsif product = application.product
    product.include?('bot')
  else
    false
  end
end