Class: Android::Resource
- Inherits:
-
Object
- Object
- Android::Resource
- Defined in:
- lib/android/resource.rb
Instance Attribute Summary collapse
-
#apk ⇒ Object
readonly
Returns the value of attribute apk.
Instance Method Summary collapse
- #extract(res, dst) ⇒ Object
-
#initialize(apk_path) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(apk_path) ⇒ Resource
Returns a new instance of Resource.
8 9 10 |
# File 'lib/android/resource.rb', line 8 def initialize(apk_path) @apk = apk_path end |
Instance Attribute Details
#apk ⇒ Object (readonly)
Returns the value of attribute apk.
6 7 8 |
# File 'lib/android/resource.rb', line 6 def apk @apk end |
Instance Method Details
#extract(res, dst) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/android/resource.rb', line 12 def extract(res, dst) Zip::ZipFile.open(@apk) do |zipfile| %w[xxhdpi xhdpi hdpi mdpi ldpi].each do |s| break unless zipfile.each do |file| if "res/drawable-#{s}/#{res}" == file.name zipfile.extract(file, dst) break end end end end end |