class Zold::Endless

Endless loop

Public Class Methods

new(title, log: Log::NULL) click to toggle source
# File lib/zold/endless.rb, line 34
def initialize(title, log: Log::NULL)
  @title = title
  @log = log
end

Public Instance Methods

run() { || ... } click to toggle source
# File lib/zold/endless.rb, line 39
def run
  start = Time.now
  Thread.current.name = @title
  begin
    loop do
      VerboseThread.new(@log).run(true) do
        yield
      end
    end
  ensure
    @log.debug("Endless loop \"#{@title}\" quit after #{Age.new(start)} of work")
  end
end