Class: CrawlerDetect::Detector
- Inherits:
-
Object
- Object
- CrawlerDetect::Detector
- Defined in:
- lib/crawler_detect/detector.rb
Overview
since 0.1.0
Instance Method Summary collapse
-
#crawler_name ⇒ String
The detected crawler name from RAW data.
-
#initialize(user_agent) ⇒ CrawlerDetect::Detector
constructor
Instance of detector class.
-
#is_crawler? ⇒ true, false
Is User-agent a crawler?.
Constructor Details
#initialize(user_agent) ⇒ CrawlerDetect::Detector
Returns instance of detector class.
8 9 10 |
# File 'lib/crawler_detect/detector.rb', line 8 def initialize(user_agent) @user_agent = user_agent.to_s.dup end |
Instance Method Details
#crawler_name ⇒ String
Returns The detected crawler name from RAW data.
18 19 20 21 |
# File 'lib/crawler_detect/detector.rb', line 18 def crawler_name return unless is_crawler? @crawler_name end |
#is_crawler? ⇒ true, false
Returns Is User-agent a crawler?.
13 14 15 |
# File 'lib/crawler_detect/detector.rb', line 13 def is_crawler? @is_crawler ||= !completely_exclusion? && matches_crawler_list? end |