Sha256: 779722982bd569066d57ab269d7fe4967e68002194ad4c0a28953c17c6d7f4cf

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

module Lhm
  module Throttler
    class Time
      include Command

      DEFAULT_TIMEOUT = 0.1
      DEFAULT_STRIDE = 40_000

      attr_accessor :timeout_seconds
      attr_accessor :stride

      def initialize(options = {})
        @timeout_seconds = options[:delay] || DEFAULT_TIMEOUT
        @stride = options[:stride] || DEFAULT_STRIDE
      end

      def execute
        sleep timeout_seconds
      end
    end

    class LegacyTime < Time
      def initialize(timeout, stride)
        @timeout_seconds = timeout / 1000.0
        @stride = stride
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lhm-2.2.0 lib/lhm/throttler/time.rb
lhm-2.1.0 lib/lhm/throttler/time.rb