|
62 | 62 | end |
63 | 63 |
|
64 | 64 | filter :platform do |val| |
65 | | - if %r{ip(?:[ao]d|hone)}i =~ val then :ios |
66 | | - elsif %r{^symbian$}i =~ val then :symbianos |
67 | | - elsif %r{w(?:eb)?os}i =~ val then :webos |
68 | | - elsif %r{ubuntu|debian}i =~ val then :linux |
69 | | - elsif %r{mac_os_x}i =~ val then :macintosh |
70 | | - elsif %r{s(?:unos|olaris)}i =~ val then :solaris |
71 | | - elsif %r{cros}i =~ val then :chromeos |
72 | | - elsif %r{kindle|kf\w+}i =~ val then :fire_os |
73 | | - elsif %r{fxos}i =~ val then :firefox_os |
| 65 | + case val |
| 66 | + when %r{ip(?:[ao]d|hone)}i then :ios |
| 67 | + when %r{^symbian$}i then :symbianos |
| 68 | + when %r{w(?:eb)?os}i then :webos |
| 69 | + when %r{ubuntu|debian}i then :linux |
| 70 | + when %r{mac_os_x}i then :macintosh |
| 71 | + when %r{s(?:unos|olaris)}i then :solaris |
| 72 | + when %r{cros}i then :chromeos |
| 73 | + when %r{kindle|kf\w+}i then :fire_os |
| 74 | + when %r{fxos}i then :firefox_os |
74 | 75 | else val |
75 | 76 | end |
76 | 77 | end |
77 | 78 |
|
78 | 79 | filter :device do |val| |
79 | | - if %r{kf\w*}i =~ val then :kindle |
80 | | - elsif %r{lg[-l_]}i =~ val then :lg |
81 | | - elsif %r{\w+tab}i =~ val then :lenovo |
82 | | - elsif %r{lumia}i =~ val then :nokia |
83 | | - elsif %r{^moto}i =~ val then :motorola |
84 | | - elsif %r{\d+dl|venue}i =~ val then :dell |
85 | | - elsif %r{me\d+x|a\df;|transformer|slider}i =~ val then :asus |
| 80 | + case val |
| 81 | + when %r{kf\w*}i then :kindle |
| 82 | + when %r{lg[-l_]}i then :lg |
| 83 | + when %r{\w+tab}i then :lenovo |
| 84 | + when %r{lumia}i then :nokia |
| 85 | + when %r{^moto}i then :motorola |
| 86 | + when %r{\d+dl|venue}i then :dell |
| 87 | + when %r{me\d+x|a\df;|transformer|slider}i then :asus |
86 | 88 | else val |
87 | 89 | end |
88 | 90 | end |
|
0 commit comments