Sha256: 7581f7ae9d6eeeb2cb1137995a58e1d14f3825b46c7cfcee2f2d152fef509732

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

require "ios_asset_extractor/version"
require 'tmpdir'

module IosAssetExtractor
  class Extractor
  	attr_reader :file_path
  	def initialize(file_path)
  		@file_path = file_path
  		@command_path = File.expand_path "../../bin/iOSAssetExtractor", __FILE__
  	end

  	def file_with_size_hash
  		Dir.mktmpdir do |dir_path|
  			system "#{@command_path} -i #{@file_path} -o #{dir_path}"
  			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

  	def extract_to(dir_path)
  		system "#{@command_path} -i #{@file_path} -o #{dir_path}"
  	end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ios_asset_extractor-0.1.1 lib/ios_asset_extractor.rb