Sha256: 55db9c166e8f5f7fd787f0ce6dd3b0edd7f35da149612adf4c9ca76bbaea920a
Contents?: true
Size: 1013 Bytes
Versions: 2
Compression:
Stored size: 1013 Bytes
Contents
require 'app_info/parser/ipa' require 'app_info/parser/ipa/info_plist' require 'app_info/parser/ipa/mobile_provision' require 'app_info/parser/apk' module AppInfo module Parser # App Platform module Platform IOS = 'iOS'.freeze ANDROID = 'Android'.freeze end def self.mac? RbConfig::CONFIG['host_os'] =~ /darwin/ ? true : false end module Util FILE_SIZE_UNITS = %w[B KB MB GB TB].freeze def self.file_size(file, humanable) file_size = File.size(file) humanable ? size_to_humanable(file_size) : file_size end def self.size_to_humanable(number) if number.to_i < 1024 exponent = 0 else max_exp = FILE_SIZE_UNITS.size - 1 exponent = (Math.log(number) / Math.log(1024)).to_i exponent = max_exp if exponent > max_exp number = format('%.2f', (number / (1024**exponent.to_f))) end "#{number} #{FILE_SIZE_UNITS[exponent]}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
app-info-1.1.2 | lib/app_info/parser.rb |
app-info-1.1.0 | lib/app_info/parser.rb |