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



1373
1374
1375
1376
1377
1378
1379
1380
1381
# File 'lib/merb-core/bootloader.rb', line 1373

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