Sha256: e4a2be05898f5119e601a39c36b95ab99102edcfd31c0e86344562530bd53f17

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2020-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

module Burner
  class Jobs
    # Arbitrarily put thread to sleep for X number of seconds
    class Sleep < Job
      attr_reader :seconds

      def initialize(name:, seconds: 0)
        super(name: name)

        @seconds = seconds.to_f

        freeze
      end

      def perform(output, _payload)
        output.detail("Going to sleep for #{seconds} second(s)")

        Kernel.sleep(seconds)

        nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
burner-1.0.0.pre.alpha.5 lib/burner/jobs/sleep.rb
burner-1.0.0.pre.alpha.4 lib/burner/jobs/sleep.rb