Class: UserAgent::Browsers::ITunes
- Defined in:
- lib/user_agent/browsers/itunes.rb
Overview
The user agent for iTunes
Some user agents: iTunes/10.6.1 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/534.53.11 iTunes/12.0.1 (Macintosh; OS X 10.10) AppleWebKit/0600.1.25 iTunes/11.1.5 (Windows; Microsoft Windows 7 x64 Business Edition Service Pack 1 (Build 7601)) AppleWebKit/537.60.15 iTunes/12.0.1 (Windows; Microsoft Windows 8 x64 Home Premium Edition (Build 9200)) AppleWebKit/7600.1017.0.24 iTunes/12.0.1 (Macintosh; OS X 10.10.1) AppleWebKit/0600.1.25
Constant Summary
Constants inherited from Webkit
Webkit::BuildVersions, Webkit::WEBKIT_PRODUCT_REGEXP, Webkit::WEBKIT_VERSION_REGEXP
Class Method Summary collapse
Instance Method Summary collapse
-
#browser ⇒ "iTunes"
Always return iTunes as the browser.
-
#build ⇒ nil, Version
The WebKit version in use if we have it.
-
#full_os ⇒ String
Parses the operating system in use.
-
#os ⇒ String
Parses the operating system in use.
-
#security ⇒ nil
Nil - not included in the user agent.
-
#version ⇒ Version
The version of iTunes in use.
Methods inherited from Webkit
#application, #localization, #platform, #webkit
Methods inherited from Base
#<=>, #application, #bot?, #eql?, #method_missing, #mobile?, #platform, #respond_to?, #to_h, #to_s, #to_str
Methods included from Comparable
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class UserAgent::Browsers::Base
Class Method Details
.extend?(agent) ⇒ Boolean
12 13 14 |
# File 'lib/user_agent/browsers/itunes.rb', line 12 def self.extend?(agent) agent.detect { |useragent| useragent.product == "iTunes" } end |
Instance Method Details
#browser ⇒ "iTunes"
Returns Always return iTunes as the browser.
17 18 19 |
# File 'lib/user_agent/browsers/itunes.rb', line 17 def browser "iTunes" end |
#build ⇒ nil, Version
Returns The WebKit version in use if we have it.
32 33 34 |
# File 'lib/user_agent/browsers/itunes.rb', line 32 def build super if webkit end |
#full_os ⇒ String
Parses the operating system in use.
64 65 66 67 68 69 70 71 72 |
# File 'lib/user_agent/browsers/itunes.rb', line 64 def full_os if application && application.comment && application.comment.length > 1 full_os = application.comment[1] full_os = "#{full_os})" if full_os =~ /\(Build [0-9][0-9][0-9][0-9]\z/ # The regex chops the ) off :( full_os end end |
#os ⇒ String
Parses the operating system in use.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/user_agent/browsers/itunes.rb', line 39 def os full_os = self.full_os if application && application.comment[0] =~ /Windows/ if full_os =~ /Windows 8\.1/ "Windows 8.1" elsif full_os =~ /Windows 8/ "Windows 8" elsif full_os =~ /Windows 7/ "Windows 7" elsif full_os =~ /Windows Vista/ "Windows Vista" elsif full_os =~ /Windows XP/ "Windows XP" else "Windows" end else super end end |
#security ⇒ nil
Returns nil - not included in the user agent.
27 28 29 |
# File 'lib/user_agent/browsers/itunes.rb', line 27 def security nil end |
#version ⇒ Version
Returns The version of iTunes in use.
22 23 24 |
# File 'lib/user_agent/browsers/itunes.rb', line 22 def version self.iTunes.version end |