Module: CrawlerDetect::Library
- Defined in:
- lib/crawler_detect/library.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: Crawlers, Exclusions, Headers, Loader
Constant Summary
collapse
- DATA_CLASSES =
[Library::Headers, Library::Exclusions, Library::Crawlers].freeze
Class Method Summary
collapse
Class Method Details
.get_array(param) ⇒ Array
22
23
24
|
# File 'lib/crawler_detect/library.rb', line 22
def get_array(param)
const_get("CrawlerDetect::Library::#{param.capitalize}").send(:data)
end
|
.get_regexp(param) ⇒ Regexp
13
14
15
16
17
18
|
# File 'lib/crawler_detect/library.rb', line 13
def get_regexp(param)
@regexp_cache[param] ||= begin
data = get_array(param)
%r{#{data.join('|')}}i
end
end
|
.reset_cache ⇒ void
This method returns an undefined value.
27
28
29
30
|
# File 'lib/crawler_detect/library.rb', line 27
def reset_cache
DATA_CLASSES.each(&:reload_data)
@regexp_cache = {}
end
|