class Headdesk::Apk::Class
A Smali bytecode class
Public Class Methods
new(smali_file)
click to toggle source
# File lib/headdesk/apk/class.rb, line 19 def initialize(smali_file) @smali = File.read(smali_file) end
path_for(decl)
click to toggle source
Formats:
android/content/Context android.content.Context
# File lib/headdesk/apk/class.rb, line 15 def self.path_for(decl) File.join(*decl.split(%r{[\/,\.]})) end
Public Instance Methods
field(name)
click to toggle source
# File lib/headdesk/apk/class.rb, line 38 def field(name) matchdata = /^\.field .* #{name}.* = "(.*)"$/.match(@smali) return nil unless matchdata Field.new(matchdata) end
field?(name)
click to toggle source
# File lib/headdesk/apk/class.rb, line 34 def field?(name) field(name) != false end
method(name)
click to toggle source
# File lib/headdesk/apk/class.rb, line 27 def method(name) matchdata = /(^\.method .* #{name}.*$[\s\S]*?\.end method)/.match(@smali) return nil unless matchdata Method.new(matchdata) end
method?(name)
click to toggle source
# File lib/headdesk/apk/class.rb, line 23 def method?(name) method(name) != false end