class FistOfFury::Clock

Attributes

schedules[R]

Public Instance Methods

current_time() click to toggle source
# File lib/fist_of_fury/clock.rb, line 11
def current_time
  FistOfFury.config.utc ? Time.now.utc : Time.now
end
schedule_for(worker) click to toggle source
# File lib/fist_of_fury/clock.rb, line 7
def schedule_for(worker)
  worker.schedule if worker.respond_to? :schedule
end

Protected Instance Methods

tick(time = current_time) click to toggle source
# File lib/fist_of_fury/clock.rb, line 23
def tick(time = current_time)
  FistOfFury.workers.each do |worker|
    FistOfFury.dispatcher.dispatch(worker, time)
  end
end
time() { || ... } click to toggle source
# File lib/fist_of_fury/clock.rb, line 17
def time
  start = current_time
  yield
  1 - (current_time.to_f - start.to_f)
end