Class: Android::Dex::DexObject

Inherits:
Object
  • Object
show all
Defined in:
lib/android/dex/dex_object.rb

Overview

parsing dex object

Defined Under Namespace

Classes: ClassDataItem, ClassDefItem, CodeItem, DebugInfoItem, EncodedCatchHandler, EncodedCatchHandlerList, EncodedField, EncodedMethod, EncodedTypeAddrPair, FieldIdItem, Header, IdsList, MapItem, MapList, MethodIdItem, ProtoIdItem, StringDataItem, StringIdItem, TryItem, TypeIdItem, TypeList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, offset) ⇒ DexObject



11
12
13
14
15
16
17
18
19
# File 'lib/android/dex/dex_object.rb', line 11

def initialize(data, offset)
  @data = data
  @offset = offset

  @params = {}
  @parsing_off = 0 # parsing offset
  parse()
  @size = @parsing_off
end

Instance Attribute Details

#sizeInteger (readonly)



9
10
11
# File 'lib/android/dex/dex_object.rb', line 9

def size
  @size
end

Instance Method Details

#[](sym) ⇒ Object



29
30
31
# File 'lib/android/dex/dex_object.rb', line 29

def [](sym)
  @params[sym.to_sym]
end

#inspectString



34
35
36
37
38
39
40
# File 'lib/android/dex/dex_object.rb', line 34

def inspect
  str = "<#{self.class}\n".dup
  @params.each  do |key,val|
    str.concat "    #{key}: #{val}\n"
  end
  str.concat '>'
end

#symbolsArray<Symbol>

returns symbol keys



23
24
25
# File 'lib/android/dex/dex_object.rb', line 23

def symbols
  @params.keys
end