Sha256: a69038bcffd3f6e8045f685c4d4aa411d4ad420d07b9c04621f8c64e81538649
Contents?: true
Size: 562 Bytes
Versions: 3
Compression:
Stored size: 562 Bytes
Contents
class Browser module Bots root = Pathname.new(File.expand_path("../../../..", __FILE__)) BOTS = YAML.load_file(root.join("bots.yml")) SEARCH_ENGINES = YAML.load_file(root.join("search_engines.yml")) def self.detect_empty_ua! @detect_empty_ua = true end def self.detect_empty_ua? !!@detect_empty_ua end def bot? Browser::Bots.detect_empty_ua? && ua.strip == "" || BOTS.any? {|key, _| ua.include?(key) } end def search_engine? SEARCH_ENGINES.any? {|key, _| ua.include?(key) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
browser-0.7.2 | lib/browser/methods/bots.rb |
browser-0.7.1 | lib/browser/methods/bots.rb |
browser-0.7.0 | lib/browser/methods/bots.rb |