Module: Sinatra::RunLater::InstanceMethods

Defined in:
lib/sinatra/run-later.rb

Instance Method Summary collapse

Instance Method Details

#run_later(&block) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sinatra/run-later.rb', line 23

def run_later(&block)
  if RunLater.run_now?
    block.call
  else
    @@run_later ||= RunLater::Worker.instance
    RunLater.queue << block
  end
end