Class: IosAssetExtractor::Extractor
- Inherits:
-
Object
- Object
- IosAssetExtractor::Extractor
- Defined in:
- lib/ios_asset_extractor.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
- #extract_to(dir_path) ⇒ Object
- #file_with_size_hash ⇒ Object
-
#initialize(file_path) ⇒ Extractor
constructor
A new instance of Extractor.
Constructor Details
#initialize(file_path) ⇒ Extractor
Returns a new instance of Extractor.
7 8 9 10 |
# File 'lib/ios_asset_extractor.rb', line 7 def initialize(file_path) @file_path = file_path @command_path = File. "../../bin/iOSAssetExtractor", __FILE__ end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/ios_asset_extractor.rb', line 6 def file_path @file_path end |
Instance Method Details
#extract_to(dir_path) ⇒ Object
26 27 28 |
# File 'lib/ios_asset_extractor.rb', line 26 def extract_to(dir_path) system "#{@command_path} -i #{@file_path} -o #{dir_path} > /dev/null 2>&1" end |
#file_with_size_hash ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ios_asset_extractor.rb', line 12 def file_with_size_hash Dir.mktmpdir do |dir_path| system "#{@command_path} -i #{@file_path} -o #{dir_path} > /dev/null 2>&1 " Dir.entries(dir_path).select do |entry| not File.directory?("#{dir_path}/#{entry}") end.map do |entry| { name: entry, size: File.size("#{dir_path}/#{entry}") } end end end |