Class: AppInfo::InfoPlist
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Defined in:
- lib/app_info/info_plist.rb
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(file) ⇒ InfoPlist
Returns a new instance of InfoPlist.
12
13
14
|
# File 'lib/app_info/info_plist.rb', line 12
def initialize(file)
@file = file
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
114
115
116
117
118
|
# File 'lib/app_info/info_plist.rb', line 114
def method_missing(method_name, *args, &block)
info.try(:[], Util.format_key(method_name)) ||
info.send(method_name) ||
super
end
|
Instance Method Details
108
109
110
|
# File 'lib/app_info/info_plist.rb', line 108
def [](key)
info.try(:[], key.to_s)
end
|
#build_version ⇒ Object
20
21
22
|
# File 'lib/app_info/info_plist.rb', line 20
def build_version
info.try(:[], 'CFBundleVersion')
end
|
#bundle_name ⇒ Object
41
42
43
|
# File 'lib/app_info/info_plist.rb', line 41
def bundle_name
info.try(:[], 'CFBundleName')
end
|
#device_family ⇒ Object
96
97
98
|
# File 'lib/app_info/info_plist.rb', line 96
def device_family
info.try(:[], 'UIDeviceFamily') || []
end
|
#device_type ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/app_info/info_plist.rb', line 67
def device_type
device_family = info.try(:[], 'UIDeviceFamily')
if device_family == [1]
AppInfo::Device::IPHONE
elsif device_family == [2]
AppInfo::Device::IPAD
elsif device_family == [1, 2]
AppInfo::Device::UNIVERSAL
elsif !info.try(:[], 'DTSDKName').nil? || !info.try(:[], 'DTPlatformName').nil?
AppInfo::Device::MACOS
end
end
|
#display_name ⇒ Object
37
38
39
|
# File 'lib/app_info/info_plist.rb', line 37
def display_name
info.try(:[], 'CFBundleDisplayName')
end
|
63
64
65
|
# File 'lib/app_info/info_plist.rb', line 63
def icons
@icons ||= ICON_KEYS[device_type]
end
|
#identifier ⇒ Object
Also known as:
bundle_id
28
29
30
|
# File 'lib/app_info/info_plist.rb', line 28
def identifier
info.try(:[], 'CFBundleIdentifier')
end
|
#ipad? ⇒ Boolean
84
85
86
|
# File 'lib/app_info/info_plist.rb', line 84
def ipad?
device_type == Device::IPAD
end
|
#iphone? ⇒ Boolean
80
81
82
|
# File 'lib/app_info/info_plist.rb', line 80
def iphone?
device_type == Device::IPHONE
end
|
#macos? ⇒ Boolean
92
93
94
|
# File 'lib/app_info/info_plist.rb', line 92
def macos?
device_type == Device::MACOS
end
|
#min_os_version ⇒ Object
45
46
47
|
# File 'lib/app_info/info_plist.rb', line 45
def min_os_version
min_sdk_version || min_system_version
end
|
#min_sdk_version ⇒ Object
Extract the Minimum OS Version from the Info.plist (iOS Only)
52
53
54
|
# File 'lib/app_info/info_plist.rb', line 52
def min_sdk_version
info.try(:[], 'MinimumOSVersion')
end
|
#min_system_version ⇒ Object
Extract the Minimum OS Version from the Info.plist (macOS Only)
59
60
61
|
# File 'lib/app_info/info_plist.rb', line 59
def min_system_version
info.try(:[], 'LSMinimumSystemVersion')
end
|
33
34
35
|
# File 'lib/app_info/info_plist.rb', line 33
def name
display_name || bundle_name
end
|
#release_type ⇒ Object
100
101
102
103
104
105
106
|
# File 'lib/app_info/info_plist.rb', line 100
def release_type
if stored?
'Store'
else
build_type
end
end
|
#release_version ⇒ Object
24
25
26
|
# File 'lib/app_info/info_plist.rb', line 24
def release_version
info.try(:[], 'CFBundleShortVersionString')
end
|
#respond_to_missing?(method_name, *args) ⇒ Boolean
120
121
122
123
124
|
# File 'lib/app_info/info_plist.rb', line 120
def respond_to_missing?(method_name, *args)
info.key?(Util.format_key(method_name)) ||
info.respond_to?(method_name) ||
super
end
|
#universal? ⇒ Boolean
88
89
90
|
# File 'lib/app_info/info_plist.rb', line 88
def universal?
device_type == Device::UNIVERSAL
end
|
16
17
18
|
# File 'lib/app_info/info_plist.rb', line 16
def version
release_version || build_version
end
|