Class: Sheap::Diff

Inherits:
Object
  • Object
show all
Includes:
Collection
Defined in:
lib/sheap.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Collection

#arrays, #bignums, #callcaches, #callinfos, #class_named, #classes, #complexes, #constcaches, #crefs, #datas, #files, #floats, #hashes, #icasses, #imemos, #instances_of, #iseqs, #matches, #ments, #modules, #of_imemo_type, #of_type, #plain_objects, #rationals, #regexps, #strings, #structs, #symbols

Constructor Details

#initialize(before, after, later = nil) ⇒ Diff

Returns a new instance of Diff.



81
82
83
84
85
# File 'lib/sheap.rb', line 81

def initialize(before, after, later = nil)
  @before = Heap.wrap(before)
  @after = Heap.wrap(after)
  @later = Heap.wrap(later) if later
end

Instance Attribute Details

#afterObject (readonly)

Returns the value of attribute after.



80
81
82
# File 'lib/sheap.rb', line 80

def after
  @after
end

#beforeObject (readonly)

Returns the value of attribute before.



80
81
82
# File 'lib/sheap.rb', line 80

def before
  @before
end

#laterObject (readonly)

Returns the value of attribute later.



80
81
82
# File 'lib/sheap.rb', line 80

def later
  @later
end

Instance Method Details

#filter(&block) ⇒ Object



92
93
94
# File 'lib/sheap.rb', line 92

def filter(&block)
  retained.filter(&block)
end

#inspectObject



96
97
98
# File 'lib/sheap.rb', line 96

def inspect
  "#<#{self.class} (#{objects.size} objects)>"
end

#retainedObject Also known as: objects



87
88
89
# File 'lib/sheap.rb', line 87

def retained
  @retained ||= HeapObjectCollection.new(calculate_retained, @after)
end