class StringsFromApk::Resource
load apk
Attributes
json[R]
Public Class Methods
new(apk_path, locale=nil)
click to toggle source
# File lib/strings_from_apk/resource.rb, line 7 def initialize apk_path, locale=nil json_folder = Dir::Tmpname.make_tmpname '/tmp/', nil json_file = File.join json_folder, 'strings.json' cmd = %Q(java -jar "#{@@jar}" "#{apk_path}" "#{json_folder}") cmd = cmd + %Q( "#{locale}") if locale `#{cmd}` @json = JSON.parse(File.read(json_file), max_nesting: 9999) # Remove the tmp folder after parsing. FileUtils.rm_rf json_folder end
Public Instance Methods
get_string(string)
click to toggle source
# File lib/strings_from_apk/resource.rb, line 19 def get_string string @json[string] end