Class: Isolator::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/isolator/configuration.rb,
lib/isolator/plugins/database_subtransactions.rb,
lib/isolator/plugins/concurrent_database_transactions.rb

Overview

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 inferred from RACK_ENV and RAILS_ENV.

  • ‘logger` - logger instance (nil by default)

  • ‘send_notifications` - whether to send notifications (through uniform_notifier); defaults to false

  • ‘backtrace_filter` - define a custom backtrace filtering (provide a callable)

  • ‘ignorer` - define a custom ignorer (must implement .prepare)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
26
27
28
29
# File 'lib/isolator/configuration.rb', line 23

def initialize
  @logger = nil
  @raise_exceptions = test_env?
  @send_notifications = false
  @backtrace_filter = ->(backtrace) { backtrace.take(5) }
  @ignorer = Isolator::Ignorer
end

Instance Attribute Details

#backtrace_filterObject

Returns the value of attribute backtrace_filter.



20
21
22
# File 'lib/isolator/configuration.rb', line 20

def backtrace_filter
  @backtrace_filter
end

#disallow_per_thread_concurrent_transactionsObject Also known as: disallow_per_thread_concurrent_transactions?

Returns the value of attribute disallow_per_thread_concurrent_transactions.



5
6
7
# File 'lib/isolator/plugins/concurrent_database_transactions.rb', line 5

def disallow_per_thread_concurrent_transactions
  @disallow_per_thread_concurrent_transactions
end

#ignorerObject

Returns the value of attribute ignorer.



20
21
22
# File 'lib/isolator/configuration.rb', line 20

def ignorer
  @ignorer
end

#loggerObject

Returns the value of attribute logger.



20
21
22
# File 'lib/isolator/configuration.rb', line 20

def logger
  @logger
end

#max_subtransactions_depthObject

Returns the value of attribute max_subtransactions_depth.



5
6
7
# File 'lib/isolator/plugins/database_subtransactions.rb', line 5

def max_subtransactions_depth
  @max_subtransactions_depth
end

#raise_exceptionsObject Also known as: raise_exceptions?

Returns the value of attribute raise_exceptions.



20
21
22
# File 'lib/isolator/configuration.rb', line 20

def raise_exceptions
  @raise_exceptions
end

#send_notificationsObject Also known as: send_notifications?

Returns the value of attribute send_notifications.



20
21
22
# File 'lib/isolator/configuration.rb', line 20

def send_notifications
  @send_notifications
end

Instance Method Details

#test_env?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/isolator/configuration.rb', line 34

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