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

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.

:api: private



1320
1321
1322
1323
1324
1325
1326
1327
1328
# File 'lib/merb-core/bootloader.rb', line 1320

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