Module: Tapioca::Runtime::Trackers::Tracker

Extended by:
T::Helpers, T::Sig
Included in:
Autoload, ConstantDefinition, Mixin, RequiredAncestor
Defined in:
lib/tapioca/runtime/trackers/tracker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



17
18
19
20
21
22
# File 'lib/tapioca/runtime/trackers/tracker.rb', line 17

def extended(base)
  Trackers.register_tracker(base)
  base.instance_exec do
    @enabled = true
  end
end

Instance Method Details

#disable!Object



26
27
28
# File 'lib/tapioca/runtime/trackers/tracker.rb', line 26

def disable!
  @enabled = false
end

#enabled?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/tapioca/runtime/trackers/tracker.rb', line 30

def enabled?
  @enabled
end

#with_disabled_tracker(&block) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/tapioca/runtime/trackers/tracker.rb', line 34

def with_disabled_tracker(&block)
  original_state = @enabled
  @enabled = false

  block.call
ensure
  @enabled = original_state
end