Class: Bot
- Inherits:
-
Object
- Object
- Bot
- Defined in:
- lib/active_device/bot.rb
Instance Attribute Summary collapse
-
#user_agent ⇒ Object
readonly
User agent string.
Class Method Summary collapse
-
.is_bot?(user_agent) ⇒ Boolean
Check UserAgent is Bot.
Instance Method Summary collapse
-
#initialize(user_agent) ⇒ Bot
constructor
Initialize with user agent string.
Constructor Details
#initialize(user_agent) ⇒ Bot
Initialize with user agent string.
11 12 13 |
# File 'lib/active_device/bot.rb', line 11 def initialize user_agent @user_agent = user_agent.strip end |
Instance Attribute Details
#user_agent ⇒ Object (readonly)
User agent string.
6 7 8 |
# File 'lib/active_device/bot.rb', line 6 def user_agent @user_agent end |
Class Method Details
.is_bot?(user_agent) ⇒ Boolean
Check UserAgent is Bot.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/active_device/bot.rb', line 17 def self.is_bot? user_agent case user_agent when /bot/i ; true when /Spider/i ; true when /Butterfly/i ; true when /Checker/i ; true when /Crawl/i ; true when /Daumoa/i ; true when /Delicious/i ; true when /del.icio.us/i ; true when /Depspid/i ; true when /Flycast/i ; true when /Heritrix/i ; true when /Httrack/i ; true when /Indexing/i ; true when /Ktxn/i ; true when /Larbin/i ; true when /Links-sql/i ; true when /Me.dium/i ; true when /Miro/i ; true when /Mozshot/i ; true when /Nutch/i ; true when /odp-entries/i ; true when /oneriot/i ; true when /pbwf/i ; true when /planetwide/i ; true when /slurp/i ; true when /Survey/i ; true when /Thunderbird/i ; true when /Vermut/i ; true else ; false end end |