Sha256: e439855955f2ded4bc786b9a1db4352b9ec816cc27df7973da31b0b27acd760b

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

module Nonnative
  class Strategy
    def initialize(strategy = 'before', timeout = 5)
      @strategy = strategy
      @timeout = timeout
    end

    def timeout
      (env_timeout || @timeout).to_i
    end

    def to_s
      (env_strategy || @strategy).to_s
    end

    private

    def env_strategy
      @env_strategy ||= ENV.fetch('NONNATIVE_STRATEGY', nil)
    end

    def env_timeout
      @env_timeout ||= ENV.fetch('NONNATIVE_TIMEOUT', nil)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nonnative-1.59.1 lib/nonnative/strategy.rb