Module: Remnant::GC::ClassMethods

Included in:
Remnant::GC
Defined in:
lib/remnant/gc.rb

Instance Method Summary collapse

Instance Method Details

#_gcObject



28
29
30
# File 'lib/remnant/gc.rb', line 28

def _gc
  Thread.current['remnant.gc'] ||= _gc_implementation
end

#_gc_implementationObject



32
33
34
35
36
37
38
39
40
# File 'lib/remnant/gc.rb', line 32

def _gc_implementation
  if ::GC.respond_to?(:time) && ::GC.respond_to?(:collections)
    Remnant::GC::Ree
  elsif defined?(::GC::Profiler)
    Remnant::GC::Profiler
  else
    Remnant::GC::Base
  end
end

#clear_statsObject



16
17
18
# File 'lib/remnant/gc.rb', line 16

def clear_stats
  _gc.clear_stats
end

#collectionsObject



24
25
26
# File 'lib/remnant/gc.rb', line 24

def collections
  _gc.collections
end

#disable_statsObject



12
13
14
# File 'lib/remnant/gc.rb', line 12

def disable_stats
  _gc.disable_stats
end

#enable_statsObject



8
9
10
# File 'lib/remnant/gc.rb', line 8

def enable_stats
  _gc.enable_stats
end

#enabled?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/remnant/gc.rb', line 4

def enabled?
  _gc.enabled?
end

#timeObject



20
21
22
# File 'lib/remnant/gc.rb', line 20

def time
  _gc.time
end