Class: MonitorManager
- Inherits:
-
Object
- Object
- MonitorManager
- Defined in:
- lib/MonitorManager.rb
Instance Method Summary collapse
- #add(monitor) ⇒ Object
-
#initialize ⇒ MonitorManager
constructor
A new instance of MonitorManager.
- #run ⇒ Object
Constructor Details
#initialize ⇒ MonitorManager
Returns a new instance of MonitorManager.
3 4 5 |
# File 'lib/MonitorManager.rb', line 3 def initialize @list = Array.new end |
Instance Method Details
#add(monitor) ⇒ Object
7 8 9 |
# File 'lib/MonitorManager.rb', line 7 def add( monitor ) @list.push monitor end |
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/MonitorManager.rb', line 11 def run while true do @list.each do |m| begin m.sanitise m.run rescue MonitorTypeExceptionHandled => e m.alert( e. ) end end sleep 0.5 end rescue Interrupt => e puts "Exiting on request ..." rescue Exception => e puts e.class.name puts "*** This is really unexpected." = false puts "Message: " + e. puts e.backtrace end |