27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/agent_orange/engine.rb', line 27
def parse(user_agent)
AgentOrange.debug "ENGINE PARSING", 2
groups = parse_user_agent_string_into_groups(user_agent)
groups.each_with_index do |content,i|
if content[:name] =~ /(#{ENGINES.collect{|cat,regex| regex}.join(')|(')})/i
populate(content)
elsif content[:comment] =~ /(#{ENGINES.collect{|cat,regex| regex}.join(')|(')})/i
chosen_content = { :name => nil, :version => nil }
additional_groups = (content[:comment])
additional_groups.each do |additional_content|
if additional_content[:name] =~ /(#{ENGINES.collect{|cat,regex| regex}.join(')|(')})/i
chosen_content = additional_content
end
end
populate(chosen_content)
end
end
analysis
self.browser = AgentOrange::Browser.new(user_agent)
end
|