Class: RubyBreaker::Runtime::MonitorSwitch

Inherits:
Object
  • Object
show all
Defined in:
lib/rubybreaker/runtime/monitor.rb

Overview

This class is a switch to turn on and off the type monitoring system. It is important to turn off the monitor once the process is inside the monitor; otherwise, it WILL fall into an infinite loop.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMonitorSwitch

Returns a new instance of MonitorSwitch.



188
# File 'lib/rubybreaker/runtime/monitor.rb', line 188

def initialize(); @switch = true end

Instance Attribute Details

#switchObject

Returns the value of attribute switch.



186
187
188
# File 'lib/rubybreaker/runtime/monitor.rb', line 186

def switch
  @switch
end

Instance Method Details

#set_to(mode) ⇒ Object



200
# File 'lib/rubybreaker/runtime/monitor.rb', line 200

def set_to(mode); @switch = mode; end

#turn_offObject



195
196
197
198
# File 'lib/rubybreaker/runtime/monitor.rb', line 195

def turn_off(); 
  RubyBreaker.log("Switch turned off")
  @switch = false; 
end

#turn_onObject



190
191
192
193
# File 'lib/rubybreaker/runtime/monitor.rb', line 190

def turn_on();
  RubyBreaker.log("Switch turned on")
  @switch = true; 
end