Class: IrusAnalytics::UserAgentFilter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/irus_analytics/user_agent_filter.rb

Instance Method Summary collapse

Constructor Details

#initializeUserAgentFilter

Singleton module defines us a instance class method and makes this privateā€¦



9
10
11
# File 'lib/irus_analytics/user_agent_filter.rb', line 9

def initialize
  set_robot_agents
end

Instance Method Details

#filter_user_agent?(user_agent) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/irus_analytics/user_agent_filter.rb', line 13

def filter_user_agent?(user_agent)
  @robot_agents.each do |robot_regexp|
    return true unless user_agent.match(robot_regexp).nil? 
  end
  return false
end

#set_robot_agentsObject



20
21
22
# File 'lib/irus_analytics/user_agent_filter.rb', line 20

def set_robot_agents
  @robot_agents = get_robots_from_config
end