Class: Merb::BootLoader::ReloadClasses::TimedExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/merb-core/bootloader.rb

Class Method Summary collapse

Class Method Details

.every(seconds, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Executes the associated block every @seconds@ seconds in a separate thread.

Parameters

seconds<Integer>

Number of seconds to sleep in between runs of &block.

&block

The block to execute periodically.

Returns

Thread

The thread executing the block periodically.



1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/merb-core/bootloader.rb', line 1218

def self.every(seconds, &block)
  Thread.abort_on_exception = true
  Thread.new do
    loop do
      sleep( seconds )
      yield
    end
    Thread.exit
  end
end