Class: CrawlerDetect::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/crawler_detect/detector.rb

Instance Method Summary collapse

Constructor Details

#initialize(user_agent) ⇒ Detector

Returns a new instance of Detector.



5
6
7
# File 'lib/crawler_detect/detector.rb', line 5

def initialize(user_agent)
  @user_agent = user_agent.to_s.dup
end

Instance Method Details

#crawler_nameObject



15
16
17
18
# File 'lib/crawler_detect/detector.rb', line 15

def crawler_name
  return unless is_crawler?
  @crawler_name
end

#is_crawler?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/crawler_detect/detector.rb', line 9

def is_crawler?
  @is_crawler ||= begin
    !completely_exclusion? && matches_crawler_list?
  end
end