Class: SmaliMethod
- Inherits:
-
Object
- Object
- SmaliMethod
- Defined in:
- lib/dex-oracle/smali_method.rb
Constant Summary collapse
- PARAMETER_ISOLATOR =
/\([^\)]+\)/
- PARAMETER_INDIVIDUATOR =
/(\[*(?:[BCDFIJSZ]|L[^;]+;))/
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#descriptor ⇒ Object
readonly
Returns the value of attribute descriptor.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(class_name, signature, body = nil) ⇒ SmaliMethod
constructor
A new instance of SmaliMethod.
- #state ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(class_name, signature, body = nil) ⇒ SmaliMethod
Returns a new instance of SmaliMethod.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dex-oracle/smali_method.rb', line 8 def initialize(class_name, signature, body = nil) @modified = false @class = class_name @name = signature[/[^\(]+/] @body = body @return_type = signature[/[^\)$]+$/] @descriptor = "#{class_name}->#{signature}" @signature = signature @parameters = [] parameter_string = signature[PARAMETER_ISOLATOR] return if parameter_string.nil? parameter_string.scan(PARAMETER_INDIVIDUATOR).each { |m| @parameters << m.first } end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
2 3 4 |
# File 'lib/dex-oracle/smali_method.rb', line 2 def body @body end |
#class ⇒ Object (readonly)
Returns the value of attribute class.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def class @class end |
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def descriptor @descriptor end |
#modified ⇒ Object
Returns the value of attribute modified.
2 3 4 |
# File 'lib/dex-oracle/smali_method.rb', line 2 def modified @modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def name @name end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def parameters @parameters end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def return_type @return_type end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
3 4 5 |
# File 'lib/dex-oracle/smali_method.rb', line 3 def signature @signature end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/dex-oracle/smali_method.rb', line 26 def ==(other) other.class == self.class && other.state == state end |
#state ⇒ Object
30 31 32 |
# File 'lib/dex-oracle/smali_method.rb', line 30 def state [@name, @class, @descriptor, @parameters, @return_type, @modified, @body] end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/dex-oracle/smali_method.rb', line 22 def to_s @descriptor end |