Module: Hometown

Defined in:
lib/hometown.rb,
lib/hometown/trace.rb,
lib/hometown/version.rb,
lib/hometown/creation_tracer.rb,
lib/hometown/disposal_tracer.rb

Defined Under Namespace

Classes: CreationTracer, DisposalTracer, Trace

Constant Summary collapse

VERSION =
"0.2.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.creation_tracerObject

Returns the value of attribute creation_tracer


11
12
13
# File 'lib/hometown.rb', line 11

def creation_tracer
  @creation_tracer
end

.disposal_tracerObject

Returns the value of attribute disposal_tracer


11
12
13
# File 'lib/hometown.rb', line 11

def disposal_tracer
  @disposal_tracer
end

Class Method Details

.for(instance) ⇒ Object


22
23
24
# File 'lib/hometown.rb', line 22

def self.for(instance)
  @creation_tracer.find_trace_for(instance)
end

.undisposedObject


26
27
28
# File 'lib/hometown.rb', line 26

def self.undisposed
  @disposal_tracer.undisposed
end

.undisposed_reportObject


30
31
32
# File 'lib/hometown.rb', line 30

def self.undisposed_report
  @disposal_tracer.undisposed_report
end

.undisposed_report_at_exitObject


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

def self.undisposed_report_at_exit
  at_exit do
    report = Hometown.undisposed_report
    report = "No leaks? Nice work!" if report.empty?
    puts report
  end
end

.watch(clazz) ⇒ Object


14
15
16
# File 'lib/hometown.rb', line 14

def self.watch(clazz)
  @creation_tracer.patch(clazz)
end

.watch_for_disposal(clazz, disposal_method) ⇒ Object


18
19
20
# File 'lib/hometown.rb', line 18

def self.watch_for_disposal(clazz, disposal_method)
  @disposal_tracer.patch(clazz, disposal_method)
end