Sha256: 473bce7a31bcd7f997829e3c193b616b785defd6e1fb815da8af4ff09c297fde

Contents?: true

Size: 502 Bytes

Versions: 9

Compression:

Stored size: 502 Bytes

Contents

# frozen_string_literal: true

module Flagsmith
  module SDK
    # Util functions
    module Intervals
      # @return [Thread] return loop thread reference
      # rubocop:disable Naming/AccessorMethodName
      def set_interval(delay)
        Thread.new do
          loop do
            sleep delay
            yield if block_given?
          end
        end
      end
      # rubocop:enable Naming/AccessorMethodName

      def clear_interval(thread)
        thread.kill
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
flagsmith-4.3.0 lib/flagsmith/sdk/intervals.rb
flagsmith-4.1.0 lib/flagsmith/sdk/intervals.rb
flagsmith-4.0.1 lib/flagsmith/sdk/intervals.rb
flagsmith-4.0.0 lib/flagsmith/sdk/intervals.rb
flagsmith-3.2.0 lib/flagsmith/sdk/intervals.rb
flagsmith-3.1.1 lib/flagsmith/sdk/intervals.rb
flagsmith-3.1.0 lib/flagsmith/sdk/intervals.rb
flagsmith-3.0.1 lib/flagsmith/sdk/intervals.rb
flagsmith-3.0.0 lib/flagsmith/sdk/intervals.rb