Class: CrawlerDetect::Detector
- Inherits:
-
Object
- Object
- CrawlerDetect::Detector
- Defined in:
- lib/crawler_detect/detector.rb
Instance Method Summary collapse
- #crawler_name ⇒ Object
-
#initialize(user_agent) ⇒ Detector
constructor
A new instance of Detector.
- #is_crawler? ⇒ Boolean
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_name ⇒ Object
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
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 |