Sha256: a0dbe12214f6358eb067ff245364ad73777f5707f3af1675df2c264c07842899

Contents?: true

Size: 316 Bytes

Versions: 5

Compression:

Stored size: 316 Bytes

Contents

# frozen_string_literal: true

module Delayed
  module Master
    module Sleep
      def loop_with_sleep(sec)
        count = [sec.to_i, 1].max
        div = sec.to_f / count
        loop do
          count.times do |i|
            yield i
            sleep div
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
delayed_job_master-3.1.2 lib/delayed/master/sleep.rb
delayed_job_master-3.1.1 lib/delayed/master/sleep.rb
delayed_job_master-3.1.0 lib/delayed/master/sleep.rb
delayed_job_master-3.0.1 lib/delayed/master/sleep.rb
delayed_job_master-3.0.0 lib/delayed/master/sleep.rb