browser 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9031876dc90f573a2ffda6d231a2c7de9ac6a439
4
- data.tar.gz: 5818318b74f5ee5be969f7e485f35ed6d52b304e
3
+ metadata.gz: 75600634f8811452d7529a87b2ec72a2db30bc06
4
+ data.tar.gz: ce2d4b9e533326ec90643ab3d5dc72bb3b9ad07c
5
5
  SHA512:
6
- metadata.gz: 335cffa588eec7e11c993d7a661d44708793509e7689b3546493db16245b9a41024d99f28ba9952f97d584963b60ef5594a0d58de300dd918afa4e15cf6e50e9
7
- data.tar.gz: 1bb8865ddbe1fbf827e820fdbc03a6028c324ab6589dde88ef65be920d73e605616c670b3865d04376a17c18df66c83457abe168bfdb9f9310b50873316f6147
6
+ metadata.gz: ea36b6d309a509c4958fe71c5a2f4f737a6f492cfcfa8cc7ddd5a646bdb319c2866f7dac0cce50ce498e4ff92408c4220d03424e190edfff35ce2b1d10917e51
7
+ data.tar.gz: 7a76ff7c859256f547cdb19733fa59d71ad8a49d9cfa615f0906d4845a9b996bbe44156399aa3747b5ddbc159581c99155f5778982aaaf5b33b1b4b8807278fe
data/README.md CHANGED
@@ -23,6 +23,8 @@ browser.name # readable browser name
23
23
  browser.version # major version number
24
24
  browser.full_version
25
25
  browser.safari?
26
+ browser.ios?
27
+ browser.app? # request performed by ios' app webview
26
28
  browser.opera?
27
29
  browser.chrome?
28
30
  browser.chrome_os?
@@ -31,27 +33,32 @@ browser.tablet?
31
33
  browser.console?
32
34
  browser.firefox?
33
35
  browser.ie?
34
- browser.ie6? # this goes up to 11
36
+ browser.ie?(6) # detect specific IE version
35
37
  browser.edge? # Newest MS browser
36
38
  browser.modern? # Webkit, Firefox 17+, IE 9+ and Opera 12+
37
39
  browser.platform # return :mac, :windows, :linux or :other
40
+ browser.ios? # detect iOS
41
+ browser.ios?(9) # detect specific iOS version
38
42
  browser.mac?
39
43
  browser.windows?
40
44
  browser.windows_x64?
41
45
  browser.linux?
42
46
  browser.blackberry?
47
+ browser.blackberry?(10) # detect specific BlackBerry version
43
48
  browser.bot?
44
49
  browser.search_engine?
45
50
  browser.phantom_js?
46
51
  browser.quicktime?
47
52
  browser.core_media?
48
53
  browser.silk?
54
+ browser.android?
55
+ browser.android?(4.2) # detect Android Jelly Bean 4.2
49
56
  browser.known? # has the browser been successfully detected?
50
57
  browser.meta # an array with several attributes
51
58
  browser.to_s # the meta info joined by space
52
59
  ```
53
60
 
54
- See the [tests](https://github.com/fnando/browser/blob/master/test/browser_spec.rb) and [implementation](https://github.com/fnando/browser/blob/master/lib/browser.rb) for more examples.
61
+ See the [tests](https://github.com/fnando/browser/blob/master/test/browser_test.rb) and [implementation](https://github.com/fnando/browser/blob/master/lib/browser.rb) for more examples.
55
62
 
56
63
  ### What defines a modern browser?
57
64
 
@@ -59,6 +66,7 @@ The current rules that define a modern browser are pretty loose:
59
66
 
60
67
  * Webkit
61
68
  * IE9+
69
+ * Microsoft Edge
62
70
  * Firefox 17+
63
71
  * Firefox Tablet 14+
64
72
  * Opera 12+
@@ -68,7 +76,7 @@ You can define your own rules. A rule must be a proc/lambda or any object that i
68
76
  ```ruby
69
77
  # Only Chrome Canary is considered modern.
70
78
  Browser.modern_rules.clear
71
- Browser.modern_rules << -> b { b.chrome? && b.version >= '37' }
79
+ Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 37 }
72
80
  ```
73
81
 
74
82
  ### Rails integration
@@ -82,7 +90,7 @@ gem "browser"
82
90
  This adds a helper method called `browser`, that inspects your current user agent.
83
91
 
84
92
  ```erb
85
- <% if browser.ie6? %>
93
+ <% if browser.ie?(6) %>
86
94
  <p class="disclaimer">You're running an older IE version. Please update it!</p>
87
95
  <% end %>
88
96
  ```
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rake/testtask"
6
6
  Rake::TestTask.new(:spec) do |t|
7
7
  t.libs << "lib"
8
8
  t.libs << "test"
9
- t.test_files = FileList["test/**/*_spec.rb"]
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
10
  t.verbose = true
11
11
  t.ruby_opts = %w[-rubygems]
12
12
  end
data/bots.yml CHANGED
@@ -1,39 +1,57 @@
1
+ 200PleaseBot: "200PleaseBot (200please.com/bot)"
1
2
  360Spider: "360Spider"
3
+ abot: "CrawlDaddy, abot (code.google.com/p/abot)"
2
4
  AddThis: "AddThis"
3
5
  ADmantX: "ADmantX Platform Semantic Analyzer"
4
6
  AdsBot-Google: "Google Adwords"
7
+ AdvBot: "AdvBot (advbot.net/bot.htmlm, advbot.org/bot.html)"
5
8
  AhrefsBot: "Ahrefs backlinks research tool"
6
9
  alexa: "Alexa Crawler"
7
10
  Apache-HttpClient: "Java http library"
8
11
  ApacheBench: "ApacheBench (ab)"
9
12
  AppEngine-Google: "Google App Engine"
10
13
  Applebot: "Apple Bot"
14
+ archive.org_bot: "Internet Archive (archive.org)"
11
15
  Ask Jeeves: "Ask Jeeves"
12
16
  AsyncHttpClient: "Java http and WebSocket client library"
13
17
  awe.sm: "Awe.sm URL expander"
14
18
  Baidu: "baidu"
15
19
  Baiduspider: "Chinese search engine"
20
+ BDCbot: "Big Data Corp (ecommerce.bigdatacorp.com.br/faq.aspx)"
16
21
  bingbot: "Microsoft bing bot"
17
22
  bitlybot: "bit.ly bot"
23
+ Blekkobot: "Blekkobot (blekko.com/about/blekkobot)"
18
24
  BLEXBot: "webmeup-crawler.com"
19
25
  bot@linkfluence.net: "Linkfluence bot"
26
+ BufferBot: "BufferBot"
20
27
  BuiBui-CheckBot: "email: buibui[at]dadapro[dot]com"
21
28
  Butterfly: "Topsy Labs"
22
29
  buzztalk: "buzztalk"
30
+ CatchBot: "CatchBot (catchbot.com)"
23
31
  check_http: "Nagios monitor"
32
+ Cliqzbot: "Cliqzbot (cliqz.com/company/cliqzbot)"
24
33
  CMRadar/0.1: "CMRadar/0.1"
25
34
  ColdFusion: "ColdFusion http library"
35
+ Comodo-Webinspector-Crawler: "Comodo (comodorobot.com)"
26
36
  Crowsnest: "Crowsnest"
27
- Crowsnest: "crowsnest.tv news portal bot"
37
+ curabot: "cura.yt"
28
38
  curl: "curl unix CLI http client"
29
39
  DAP/NetHTTP: "DAP/NetHTTP"
40
+ datagnionbot: "datagnion.com/bot.html"
41
+ Daumoa: "Korean portal and search engine indexing bot"
30
42
  developers.google.com/+/web/snippet/: "Google Plus"
43
+ diffbot: "Diffbot (diffbot.com)"
31
44
  DigitalPersona Fingerprint Software: "HP Fingerprint scanner"
45
+ Domain Re-Animator Bot: "Domain Re-Animator Bot (http://domainreanimator.com) - support@domainreanimator.com"
46
+ domainsbot: "DomainsBot (domainsbot.com)"
47
+ DomainTunoCrawler: "DomainTuno (domaintuno.com/robot)"
32
48
  DotBot: "Dot Bot"
33
49
  DuckDuckBot: "Duck Duck Go"
50
+ DuckDuckGo: "Duck Duck Go"
34
51
  Embedly: "Embedly"
35
52
  EOAAgent: "EOAAgent"
36
53
  EventMachine HttpClient: "Ruby http library"
54
+ EveryoneSocialBot: "EveryoneSocial (everyonesocial.com)"
37
55
  EvriNid: "Evri bot"
38
56
  Exabot: "Exalead's bot"
39
57
  ExaleadCloudView: "ExaleadCloudView"
@@ -41,41 +59,50 @@ facebookexternalhit: "Facebook Bot"
41
59
  Facebot: "Facebook Bot"
42
60
  FeedBurner: "RSS bot"
43
61
  Feedfetcher-Google: "Google Feedfetcher"
62
+ Findxbot: "Findxbot (http://www.findxbot.com)"
44
63
  FlipboardProxy: "FlipboardProxy"
64
+ FriendFeedBot: "FriendFeed (friendfeed.com/about/bot)"
45
65
  Genieo: "Genieo Web filter bot"
46
66
  getprismatic.com: "getprismatic.com"
47
67
  Gigabot: "Gigabot spider"
68
+ Gimme60bot: "Gimme60 (gimme60.com)"
69
+ gimme60bot: "Gimme60 (gimme60.com)"
70
+ GimmeUSAbot: "Gimme60 (gimme60.com)"
48
71
  Go http package: "Go http library"
49
- Google Web Preview: "Google Instant Previews crawler"
50
72
  Google Page Speed Insights: "Google Page Speed Insights"
73
+ Google Web Preview: "Google Instant Previews crawler"
51
74
  Googlebot: "Google spider"
75
+ GrapeshotCrawler: "Mozilla/5.0 (compatible; GrapeshotCrawler/2.0; +http://www.grapeshot.co.uk/crawler.php)"
76
+ Gravitybot: "Gravitybot (gravity.com)"
52
77
  Hatena::Bookmark: "Hatena::Bookmark"
53
78
  heritrix: "heritrix"
54
79
  HTMLParser: "HTMLParser"
80
+ HTTP_Request2: "HTTP_Request2"
55
81
  HTTPClient: "HTTPClient"
56
82
  https://developers.google.com/+/web/snippet: "Google+ Snippet Fetcher"
57
- HTTP_Request2: "HTTP_Request2"
58
- HubSpot Connect: "HubSpot Connect"
59
- ia_archiver(OS-Wayback): "ia_archiver(OS-Wayback)"
83
+ HubSpot: "HubSpot"
84
+ ia_archiver: "Internet Archive (WayBackMachine)"
60
85
  iCoreService: "iCoreService"
86
+ idmarch: "idmarch.org/bot.html"
61
87
  InAGist: "URL resolver"
62
- Insieve Bot: "Insieve Bot"
63
- InsieveBot: "InsieveBot"
64
- Instapaper: "Instapaper"
88
+ Insieve: "Insieve Bot"
65
89
  Insitesbot: "Insitesbot"
90
+ Instapaper: "Instapaper"
66
91
  IstellaBot: "IstellaBot"
67
92
  jack: "jack"
68
- Jakarta Commons-HttpClient: "Jakarta Commons-HttpClient"
69
93
  Jakarta Commons: "Jakarta Commons HttpClient"
70
94
  Java: "Generic Java http library"
71
95
  Jetslide: "Jetslide"
72
96
  JS-Kit: "URL resolver"
73
- Kimengi/nineconnections.com: "Kimengi/nineconnections.com"
74
- Kimengi: "nineconnections.com bot"
97
+ Kemvibot: "Kemvi (kemvi.com)"
98
+ Kimengi: "Kimengi/nineconnections.com bot"
75
99
  knows.is: "knows.is"
100
+ Kojitsubot: "Kojitsubot"
101
+ KomodiaBot: "KomodiaBot"
76
102
  kraken: "kraken"
77
103
  Laconica: "Laconica"
78
104
  libwww-perl: "Perl client-server library loved by script kids"
105
+ Lijit Crawler: "Lijit (lijit.com/robot/crawler)"
79
106
  linkdexbot: "Linkdex Bot"
80
107
  LinkedInBot: "LinkedIn"
81
108
  LinksCrawler: "LinksCrawler"
@@ -88,62 +115,84 @@ Lumibot: "Lumibot"
88
115
  lwp-trivial: "Another Perl library loved by script kids"
89
116
  magpie-crawler: "magpie-crawler"
90
117
  Mail.RU_Bot: "Mail.ru Bot"
118
+ meanpathbot: "meanpath (meanpath.com)"
91
119
  Mediapartners-Google: "Google Adsense bot"
92
120
  MegaIndex.ru: "Mozilla/5.0 (compatible; MegaIndex.ru/2.0; +https://www.megaindex.ru/?tab=linkAnalyze)"
121
+ memoryBot: "mignify.com/bot.html"
122
+ memorybot: "mignify.com/bot.html"
93
123
  MetaURI: "MetaURI"
94
- MetaURI: "URI meta information extractor bot"
95
124
  MFE_expand: "Mcafee spider"
125
+ MIR web crawler: "MIR web crawler (mirproject15@gmail.com)"
96
126
  MJ12bot: "Majestic-12 spider"
97
127
  MojeekBot: "Mojeek UK search crawler"
128
+ MS Search 6.0 Robot: "MS Search 6.0 Robot"
98
129
  msnbot: "Microsoft bot"
130
+ NerdyBot: "NerdyBot"
99
131
  netState: "netEstate NE Crawler"
100
132
  Netvibes: "Personalized dashboard bot"
133
+ NetzCheckBot: "bot@netzcheck.com"
101
134
  NewRelicPinger: "NewRelic monitor"
102
- newsme: "Link analyzer"
103
135
  newsme: "newsme"
136
+ niki-bot: "niki-bot"
104
137
  NING: "NING - Yet Another Twitter Swarmer"
105
138
  Nutch: "Apache search spider"
139
+ OpenHoseBot: "OpenHoseBot (http://www.openhose.org/bot.html)"
140
+ OrangeBot: "OrangeBot (support.orangebot@orange.com)"
141
+ PagesInventory: "pagesinventory.com"
106
142
  Panopta: "Monitoring service"
107
- PaperLiBot: "PaperLi content curation service"
108
143
  PaperLiBot: "PaperLi is another content curation service"
109
144
  peerindex: "peerindex"
110
145
  PercolateCrawler: "PercolateCrawler"
146
+ PerfectMarketKWTbot: "PerfectMarket (perfectmarket.com)"
111
147
  PhantomJS: "PhantomJS"
112
148
  Pingdom: "Pingdom monitoring"
113
149
  Pinterest: "Pinterest"
150
+ Plukkie: "botje.com/plukkie.htm"
151
+ psbot-page: "picsearch.com/bot.html"
114
152
  publiclibraryarchive.org: "publiclibraryarchive.org"
115
153
  PycURL: "Python http library"
116
154
  Python-httplib2: "Python-httplib2"
117
155
  python-requests: "Python http library"
118
- python-requests: "python-requests"
119
156
  Python-urllib: "Python http library"
120
157
  QuerySeeker: "QuerySeekerSpider ( http://queryseeker.com/bot.html )"
121
158
  QuickLook: "QuickLook"
159
+ Re-Animator: "Domain Re-Animator Bot (http://domainreanimator.com)"
122
160
  Readability: "Readability"
123
161
  RebelMouse: "RebelMouse"
124
162
  redditbot: "Reddit Bot"
125
163
  RelateIQ: "RelateIQ"
126
164
  Riddler: "Riddler Bot"
127
165
  rogerbot: "SeoMoz spider"
128
- Ruby/1.9.3: "Ruby/1.9.3"
166
+ RSSMicro: "RSS/Atom Feed Robot (rssmicro.com)"
129
167
  Ruby: "Ruby"
130
168
  Scrapy: "Scrapy"
169
+ Screaming Frog SEO Spider: Screaming Frog SEO Spider
170
+ SearchmetricsBot: "SearchmetricsBot"
131
171
  SemrushBot: "SEO analysis bot"
172
+ SEOkicks-Robot: "SEOKicks (seokicks.de/robot.html)"
132
173
  SeznamBot: "SeznamBot"
133
174
  ShopWiki: "ShopWiki"
134
175
  ShortLinkTranslate: "Link shortener"
135
176
  ShowyouBot: "Showyou iOS app spider"
136
177
  Siege: "Joe Dog Siege"
178
+ SISTRIX: "Mozilla/5.0 (compatible; SISTRIX Crawler; http://crawler.sistrix.net/)"
137
179
  SiteUptime: "Site monitoring services"
138
180
  Slack: "Slackbot-LinkExpanding"
181
+ Slackbot: "api.slack.com/robots"
139
182
  Slurp: "Yahoo spider"
183
+ SMTBot: "SimilarTech (http://www.similartech.com/smtbot)"
140
184
  Sogou: "Chinese search engine"
185
+ spbot: "OpenLinkProfiler (http://openlinkprofiler.org/bot)"
141
186
  spider: "generic web spider"
142
187
  Spinn3r: "Spinn3r aggregator"
188
+ SputnikBot: "SputnikBot (http://corp.sputnik.ru/webmaster)"
143
189
  StatusCake: "StatusCake"
190
+ StructuredDataTestingTool: 'Google-StructuredDataTestingTool'
144
191
  Test Certificate Info: "C http library?"
192
+ TinEye: "TinEye-bot/0.51 (see http://www.tineye.com/crawler.html)"
145
193
  trendictionbot: "trendiction search"
146
194
  TurnitinBot: "TurnitinBot"
195
+ tweetedtimes: "The Tweeted Times"
147
196
  TweetmemeBot: "TweetMeMe Crawler"
148
197
  Twikle: "Social web search bot"
149
198
  TwitJobSearch: "TwitJobSearch"
@@ -151,23 +200,31 @@ Twitmunin: "Twitmunin"
151
200
  Twitterbot: "Twitter URL expander"
152
201
  Twurly: "Twurly"
153
202
  Typhoeus: "Typhoeus"
154
- UnwindFetch: "Gnip URL expander"
155
- UnwindFetchor: "Gnip crawler"
203
+ uMBot: "uberMetrics"
204
+ UnwindFetch: "Gnip"
205
+ UptimeRobot: "Uptime Robot"
156
206
  Vagabondo: "Vagabondo"
157
207
  VB Project: "Visual Basic"
208
+ Vigil: "Vigil (vigil-app.com/bot.html)"
158
209
  vkShare: "VKontake Sharer"
159
210
  VoilaBot: "VoilaBot"
211
+ VRCrawler: "ventureradar.com/crawler"
212
+ WASALive-Bot: "blog.wasalive.com/wasalive-bots"
213
+ WBSearchBot: "Ware Bay Best Buys (http://www.warebay.com/bot.html)"
160
214
  Webscout: "Webscout"
215
+ WeSEE: "WeSEE (www.wesee.com/bot)"
161
216
  Wget: "wget unix CLI http client"
217
+ wget: "wget unix CLI http client"
162
218
  WordPress: "WordPress spider"
163
219
  Wormly: "WormlyBot"
220
+ Wotbox: "Wotbox (http://www.wotbox.com/bot)"
164
221
  Xenu Link Sleuth: "Xenu Link Sleuth"
165
222
  XoviBot: "XoviBot"
166
- YandexBot: "Yandex spider"
167
- YandexDirect: "Yandex Direct spider"
168
- YandexMetrika: "Yandex Metrika spider"
223
+ yacybot: "YaCy (yacy.net)"
224
+ Yandex: "Yandex, Yandex Direct, Yandex Metrika, Yandex News (yandex.com)"
225
+ Yeti: "Naver Corp (help.naver.com/robots)"
169
226
  YOURLS: "YOURLS"
170
227
  zelist.ro: "feed parser"
171
228
  ZIBB: "ZIBB spider"
229
+ zitebot: "Zite"
172
230
  ZyBorg: "Zyborg? Hmmm...."
173
- StructuredDataTestingTool: 'Google-StructuredDataTestingTool'
@@ -26,6 +26,9 @@ Gem::Specification.new do |s|
26
26
  "# If this is important for you, please read #" ,
27
27
  "# https://github.com/fnando/browser#internet-explorer #" ,
28
28
  "# #" ,
29
+ "# iOS webviews and web apps aren't detect as Safari #" ,
30
+ "# anymore, so be aware of that if that's your case. #" ,
31
+ "# #" ,
29
32
  "###########################################################" ,
30
33
  "\n"
31
34
  ].join("\n")
@@ -36,4 +39,6 @@ Gem::Specification.new do |s|
36
39
  s.add_development_dependency "rack-test"
37
40
  s.add_development_dependency "minitest"
38
41
  s.add_development_dependency "minitest-utils"
42
+ s.add_development_dependency "pry-meta"
43
+ s.add_development_dependency "minitest-autotest"
39
44
  end
@@ -36,7 +36,6 @@
36
36
  "fr-ch": "French/Switzerland"
37
37
  "fr-ca": "French/Canada"
38
38
  "fr-lu": "French/Luxembourg"
39
- "gd": "Gaelic"
40
39
  "gl": "Galician"
41
40
  "de": "German"
42
41
  "de-at": "German/Austria"
@@ -7,6 +7,7 @@ require "browser/middleware/context"
7
7
  require "browser/rails" if defined?(::Rails)
8
8
 
9
9
  require "browser/methods/ie"
10
+ require "browser/methods/blackberry"
10
11
  require "browser/methods/platform"
11
12
  require "browser/methods/mobile"
12
13
  require "browser/methods/devices"
@@ -14,6 +15,7 @@ require "browser/methods/consoles"
14
15
  require "browser/methods/language"
15
16
  require "browser/methods/bots"
16
17
  require "browser/methods/tv"
18
+ require "browser/methods/proxy"
17
19
 
18
20
  require "browser/meta/base"
19
21
  require "browser/meta/generic_browser"
@@ -23,11 +25,13 @@ require "browser/meta/ios"
23
25
  require "browser/meta/mobile"
24
26
  require "browser/meta/modern"
25
27
  require "browser/meta/platform"
28
+ require "browser/meta/proxy"
26
29
  require "browser/meta/safari"
27
30
  require "browser/meta/webkit"
28
31
 
29
32
  class Browser
30
33
  include IE
34
+ include BlackBerry
31
35
  include Platform
32
36
  include Mobile
33
37
  include Devices
@@ -35,6 +39,7 @@ class Browser
35
39
  include Language
36
40
  include Bots
37
41
  include Tv
42
+ include Proxy
38
43
 
39
44
  # Set browser's UA string.
40
45
  attr_accessor :user_agent
@@ -46,12 +51,14 @@ class Browser
46
51
  ie: "Internet Explorer", # Must come before android
47
52
  chrome: "Chrome", # Must come before android
48
53
  firefox: "Firefox", # Must come before android
54
+ uc_browser: "UC Browser", # Must come before android
49
55
  android: "Android",
56
+ blackberry_running_safari: "Safari",
50
57
  blackberry: "BlackBerry",
51
58
  core_media: "Apple CoreMedia",
52
- ipad: "iPad",
53
- iphone: "iPhone",
54
- ipod: "iPod Touch",
59
+ ipad: "iPad", # Must come before safari
60
+ iphone: "iPhone", # Must come before safari
61
+ ipod: "iPod Touch", # Must come before safari
55
62
  nintendo: "Nintendo",
56
63
  opera: "Opera",
57
64
  phantom_js: "PhantomJS",
@@ -60,6 +67,7 @@ class Browser
60
67
  quicktime: "QuickTime",
61
68
  safari: "Safari",
62
69
  xbox: "Xbox",
70
+ nokia: "Nokia S40 Ovi Browser",
63
71
 
64
72
  # This must be last item, since Ruby 1.9+ has ordered keys.
65
73
  other: "Other",
@@ -119,7 +127,7 @@ class Browser
119
127
  # Get the browser identifier.
120
128
  def id
121
129
  NAMES.keys
122
- .find {|id| respond_to?("#{id}?") ? public_send("#{id}?") : id }
130
+ .find {|id| respond_to?("#{id}?", true) ? send("#{id}?") : id }
123
131
  end
124
132
 
125
133
  # Return major version.
@@ -168,11 +176,11 @@ class Browser
168
176
 
169
177
  # Detect if browser is Safari.
170
178
  def safari?
171
- (ua =~ /Safari/ || safari_webapp_mode?) && ua !~ /Android|Chrome|CriOS|PhantomJS/
179
+ !!((ua =~ /Safari/) && ua !~ /Android|Chrome|CriOS|PhantomJS/)
172
180
  end
173
181
 
174
182
  def safari_webapp_mode?
175
- (ipad? || iphone?) && ua =~ /AppleWebKit/
183
+ !!((ipad? || iphone?) && ua =~ /AppleWebKit/)
176
184
  end
177
185
 
178
186
  # Detect if browser is Firefox.
@@ -182,7 +190,7 @@ class Browser
182
190
 
183
191
  # Detect if browser is Chrome.
184
192
  def chrome?
185
- ua =~ /Chrome|CriOS/ && !opera? && !edge?
193
+ !!(ua =~ /Chrome|CriOS/ && !opera? && !edge?)
186
194
  end
187
195
 
188
196
  # Detect if browser is Opera.
@@ -195,6 +203,16 @@ class Browser
195
203
  !!(ua =~ /Silk/)
196
204
  end
197
205
 
206
+ # Detect if browser is Yandex.
207
+ def yandex?
208
+ !!(ua =~ /YaBrowser/)
209
+ end
210
+
211
+ # Detect if browser is UCBrowser.
212
+ def uc_browser?
213
+ !!(ua =~ /UCBrowser/)
214
+ end
215
+
198
216
  def known?
199
217
  id != :other
200
218
  end
@@ -213,4 +231,16 @@ class Browser
213
231
  def to_s
214
232
  meta.to_a.join(" ")
215
233
  end
234
+
235
+ private
236
+
237
+ def detect_version?(actual_version, expected_version)
238
+ return true unless expected_version
239
+ actual_version.to_s.start_with?(expected_version.to_s)
240
+ end
241
+
242
+ def deprecate(message)
243
+ offender = caller[1].to_s[/^(.*?\.rb:\d+).*?$/, 1]
244
+ $stderr << "\n#{message} (called from #{offender})\n"
245
+ end
216
246
  end