Module: CrawlerDetect
- Defined in:
- lib/crawler_detect.rb,
lib/crawler_detect/config.rb,
lib/crawler_detect/library.rb,
lib/crawler_detect/version.rb,
lib/crawler_detect/detector.rb,
lib/crawler_detect/library/loader.rb,
lib/crawler_detect/library/headers.rb,
lib/crawler_detect/library/crawlers.rb,
lib/crawler_detect/library/exclusions.rb
Overview
Defined Under Namespace
Modules: Library Classes: Config, Detector
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
-
.config ⇒ CrawlerDetect::Config
Instance of configuration class.
-
.is_crawler?(user_agent) ⇒ true, false
Is User-agent a crawler?.
-
.new(user_agent) ⇒ CrawlerDetect::Detector
Instance of detector class.
- .setup!(&config) ⇒ Object
Class Method Details
.config ⇒ CrawlerDetect::Config
Returns Instance of configuration class.
40 41 42 |
# File 'lib/crawler_detect.rb', line 40 def config @config ||= CrawlerDetect::Config.new end |
.is_crawler?(user_agent) ⇒ true, false
Returns Is User-agent a crawler?.
27 28 29 |
# File 'lib/crawler_detect.rb', line 27 def is_crawler?(user_agent) detector(user_agent).is_crawler? end |
.new(user_agent) ⇒ CrawlerDetect::Detector
Returns Instance of detector class.
21 22 23 |
# File 'lib/crawler_detect.rb', line 21 def new(user_agent) detector(user_agent) end |
.setup!(&config) ⇒ Object
33 34 35 36 |
# File 'lib/crawler_detect.rb', line 33 def setup!(&config) @config = CrawlerDetect::Config.new(&config) Library::DATA_CLASSES.each(&:reload_data) end |