Skip to content

Commit

Permalink
Added Opera on Windows CE to specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
yolk committed Jun 16, 2010
1 parent c87d732 commit 721300e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/user_agent.rb
Expand Up @@ -182,17 +182,19 @@ def identify_os
end

def identify_os_windows
return unless element = @comment_elements.detect{|e| e =~ /^win.*\d/i} or
return unless element = @comment_elements.detect{|e| e =~ /^win.*(\d|ce)/i} or
@user_agent =~ /Microsoft Windows/
@os_name = 'Windows'
@os_version = case element
when /98/ then '98'
when /9x 4.90/ then 'ME'
when /NT 4.0/ then 'NT'
when /NT 5.0/ then '2000'
when /NT 5.1/ then 'XP'
when /NT 6.0/ then 'Vista'
when /NT 6.1/ then '7'
when /Win.*95/ then '95'
when /Win.*98/ then '98'
when /Win.*9x 4.90/ then 'ME'
when /Win.*NT 4.0/ then 'NT'
when /Win.*NT 5.0/ then '2000'
when /Win.*NT 5.1/ then 'XP'
when /Win.*NT 6.0/ then 'Vista'
when /Win.*NT 6.1/ then '7'
when /Win.*CE/ then 'CE'
end
end

Expand Down
2 changes: 2 additions & 0 deletions spec/user_agent_spec.rb
Expand Up @@ -70,6 +70,8 @@
["Opera", "9.62", "Linux"],
"Opera/9.80 (Windows NT 5.1; U; cs) Presto/2.2.15 Version/10.00" =>
["Opera", "10.00", "Windows", "XP"],
"Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; PPC; 480x640) Opera 8.60 [en]" =>
["Opera", "8.60", "Windows", "CE"],

# Opera Mini
"Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.13918/516; U; de) Presto/2.2.0" =>
Expand Down

0 comments on commit 721300e

Please sign in to comment.