module CrawlerDetect::Library
@since 0.1.0
Constants
- DATA_CLASSES
Public Class Methods
get_array(param)
click to toggle source
@param param [String] Name of raw data @return [Array]
# File lib/crawler_detect/library.rb, line 22 def get_array(param) const_get("CrawlerDetect::Library::#{param.capitalize}").send(:data) end
get_regexp(param)
click to toggle source
@param param [String] Name of raw data @return [Regexp]
# 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()
click to toggle source
@return [void]
# File lib/crawler_detect/library.rb, line 27 def reset_cache DATA_CLASSES.each(&:reload_data) @regexp_cache = {} end