Class: SmaliFile
- Inherits:
-
Object
- Object
- SmaliFile
- Includes:
- Logging
- Defined in:
- lib/dex-oracle/smali_file.rb
Constant Summary collapse
- ACCESSOR =
/(?:abstract|annotation|constructor|enum|final|interface|native|private|protected|public|static|strictfp|synchronized|synthetic|transient|volatile)/
- TYPE =
/(?:[IJFDZBCV]|L[^;]+;)/
- CLASS =
/^\.class (?:#{ACCESSOR} )+(L[^;]+;)/
- SUPER =
/^\.super (L[^;]+;)/
- INTERFACE =
/^\.implements (L[^;]+;)/
- FIELD =
/^\.field (?:#{ACCESSOR} )+([^\s]+)$/
- METHOD =
/^\.method (?:#{ACCESSOR} )+([^\s]+)$/
Instance Attribute Summary collapse
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#interfaces ⇒ Object
readonly
Returns the value of attribute interfaces.
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#super ⇒ Object
readonly
Returns the value of attribute super.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ SmaliFile
constructor
A new instance of SmaliFile.
- #to_s ⇒ Object
- #update ⇒ Object
Methods included from Logging
included, logger, #logger, logger=
Constructor Details
#initialize(file_path) ⇒ SmaliFile
Returns a new instance of SmaliFile.
19 20 21 22 23 |
# File 'lib/dex-oracle/smali_file.rb', line 19 def initialize(file_path) @file_path = file_path @modified = false parse(file_path) end |
Instance Attribute Details
#class ⇒ Object (readonly)
Returns the value of attribute class.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def class @class end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def content @content end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def fields @fields end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def file_path @file_path end |
#interfaces ⇒ Object (readonly)
Returns the value of attribute interfaces.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def interfaces @interfaces end |
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def methods @methods end |
#super ⇒ Object (readonly)
Returns the value of attribute super.
7 8 9 |
# File 'lib/dex-oracle/smali_file.rb', line 7 def super @super end |
Instance Method Details
#to_s ⇒ Object
35 36 37 |
# File 'lib/dex-oracle/smali_file.rb', line 35 def to_s @class end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/dex-oracle/smali_file.rb', line 25 def update @methods.each do |m| next unless m.modified logger.debug("Updating method: #{m}") update_method(m) m.modified = false end File.open(@file_path, 'w') { |f| f.write(@content) } end |