Class: AppInfo::Protobuf::Resources
- Inherits:
-
Object
- Object
- AppInfo::Protobuf::Resources
- Includes:
- Helper::Protobuf
- Defined in:
- lib/app_info/protobuf/resources.rb
Defined Under Namespace
Classes: Entry, Package, Value
Instance Attribute Summary collapse
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#tool_fingerprint ⇒ Object
readonly
Returns the value of attribute tool_fingerprint.
Class Method Summary collapse
Instance Method Summary collapse
- #find(reference, locale: '') ⇒ Object
- #first_package ⇒ Object
-
#initialize(doc) ⇒ Resources
constructor
A new instance of Resources.
Methods included from Helper::Protobuf
Constructor Details
#initialize(doc) ⇒ Resources
Returns a new instance of Resources.
19 20 21 |
# File 'lib/app_info/protobuf/resources.rb', line 19 def initialize(doc) parse(doc) end |
Instance Attribute Details
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
17 18 19 |
# File 'lib/app_info/protobuf/resources.rb', line 17 def packages @packages end |
#tool_fingerprint ⇒ Object (readonly)
Returns the value of attribute tool_fingerprint.
17 18 19 |
# File 'lib/app_info/protobuf/resources.rb', line 17 def tool_fingerprint @tool_fingerprint end |
Class Method Details
.parse(io) ⇒ Object
10 11 12 13 |
# File 'lib/app_info/protobuf/resources.rb', line 10 def self.parse(io) doc = Aapt::Pb::ResourceTable.decode(io) new(doc) end |
Instance Method Details
#find(reference, locale: '') ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/app_info/protobuf/resources.rb', line 23 def find(reference, locale: '') type, name = reference_segments(reference) packages.each_value do |package| next unless value = package.find(name, type: type, locale: locale) return value end nil end |
#first_package ⇒ Object
34 35 36 |
# File 'lib/app_info/protobuf/resources.rb', line 34 def first_package packages.values[0] end |