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



1338
1339
1340
1341
1342
1343
1344
1345
1346
# File 'lib/merb-core/bootloader.rb', line 1338

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