Module: Sheap::Collection

Included in:
Diff, Heap, HeapObjectCollection
Defined in:
lib/sheap.rb

Instance Method Summary collapse

Instance Method Details

#arraysObject



52
# File 'lib/sheap.rb', line 52

def arrays; of_type("ARRAY"); end

#bignumsObject



62
# File 'lib/sheap.rb', line 62

def bignums; of_type("BIGNUM"); end

#callcachesObject



70
# File 'lib/sheap.rb', line 70

def callcaches; of_imemo_type("callcache"); end

#callinfosObject



72
# File 'lib/sheap.rb', line 72

def callinfos; of_imemo_type("callinfo"); end

#class_named(name) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/sheap.rb', line 19

def class_named(name)
  filter do |obj|
    obj.json.include?(name) &&
      obj.type_str == "CLASS" &&
      obj.name == name
  end
end

#classesObject



45
# File 'lib/sheap.rb', line 45

def classes; of_type("CLASS"); end

#complexesObject



66
# File 'lib/sheap.rb', line 66

def complexes; of_type("COMPLEX"); end

#constcachesObject



71
# File 'lib/sheap.rb', line 71

def constcaches; of_imemo_type("constcache"); end

#crefsObject



73
# File 'lib/sheap.rb', line 73

def crefs; of_imemo_type("cref"); end

#datasObject



56
# File 'lib/sheap.rb', line 56

def datas; of_type("DATA"); end

#filesObject



57
# File 'lib/sheap.rb', line 57

def files; of_type("FILE"); end

#floatsObject



64
# File 'lib/sheap.rb', line 64

def floats; of_type("FLOAT"); end

#hashesObject



51
# File 'lib/sheap.rb', line 51

def hashes; of_type("HASH"); end

#icassesObject



46
# File 'lib/sheap.rb', line 46

def icasses; of_type("ICLASS"); end

#imemosObject



48
# File 'lib/sheap.rb', line 48

def imemos; of_type("IMEMO"); end

#instances_of(klass) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/sheap.rb', line 27

def instances_of(klass)
  addr = klass.address
  filter do |obj|
    obj.json.include?(addr) &&
      obj.class_addr == addr
  end
end

#iseqsObject

imemo types



69
# File 'lib/sheap.rb', line 69

def iseqs; of_imemo_type("iseq"); end

#matchesObject



60
# File 'lib/sheap.rb', line 60

def matches; of_type("MATCH"); end

#mentsObject



74
# File 'lib/sheap.rb', line 74

def ments; of_imemo_type("ment"); end

#modulesObject



47
# File 'lib/sheap.rb', line 47

def modules; of_type("MODULE"); end

#of_imemo_type(type) ⇒ Object



40
41
42
43
# File 'lib/sheap.rb', line 40

def of_imemo_type(type)
  type = type.to_s.downcase
  filter { |o| o.json.include?(type) && o.imemo_type == type }
end

#of_type(type) ⇒ Object



35
36
37
38
# File 'lib/sheap.rb', line 35

def of_type(type)
  type = type.to_s.upcase
  filter { |o| o.json.include?(type) && o.type_str == type }
end

#plain_objectsObject



54
# File 'lib/sheap.rb', line 54

def plain_objects; of_type("OBJECT"); end

#rationalsObject



65
# File 'lib/sheap.rb', line 65

def rationals; of_type("RATIONAL"); end

#regexpsObject



59
# File 'lib/sheap.rb', line 59

def regexps; of_type("REGEXP"); end

#stringsObject



50
# File 'lib/sheap.rb', line 50

def strings; of_type("STRING"); end

#structsObject



55
# File 'lib/sheap.rb', line 55

def structs; of_type("STRUCT"); end

#symbolsObject



63
# File 'lib/sheap.rb', line 63

def symbols; of_type("SYMBOL"); end