Sha256: eb1b7b22044c2461c7343685a3e4ca2c2fbbac8c90ee073fe1361a5317b7cc6b

Contents?: true

Size: 836 Bytes

Versions: 10

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module Isolator
  # Isolator configuration:
  #
  # - `raise_exceptions` - whether to raise an exception in case of offense;
  #   defaults to true in test env and false otherwise.
  #   NOTE: env is infered from RACK_ENV and RAILS_ENV.
  #
  # - `logger` - logger instance (nil by default)
  #
  # - `send_notifications` - whether to send notifications (through uniform_notifier);
  #   defauls to false
  class Configuration
    attr_accessor :raise_exceptions, :logger, :send_notifications

    def initialize
      @logger = nil
      @raise_exceptions = test_env?
      @send_notifications = false
    end

    alias raise_exceptions? raise_exceptions
    alias send_notifications? send_notifications

    def test_env?
      ENV["RACK_ENV"] == "test" || ENV["RAILS_ENV"] == "test"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
isolator-0.5.0 lib/isolator/configuration.rb
isolator-0.4.0 lib/isolator/configuration.rb
isolator-0.3.0 lib/isolator/configuration.rb
isolator-0.2.2 lib/isolator/configuration.rb
isolator-0.2.1 lib/isolator/configuration.rb
isolator-0.2.0 lib/isolator/configuration.rb
isolator-0.1.1 lib/isolator/configuration.rb
isolator-0.1.0 lib/isolator/configuration.rb
isolator-0.1.0.pre2 lib/isolator/configuration.rb
isolator-0.1.0.pre lib/isolator/configuration.rb