Module: Aptible::Resource

Includes:
GemConfig::Base
Defined in:
lib/aptible/resource.rb,
lib/aptible/resource/base.rb,
lib/aptible/resource/errors.rb,
lib/aptible/resource/adapter.rb,
lib/aptible/resource/boolean.rb,
lib/aptible/resource/version.rb,
lib/aptible/resource/null_retry_coordinator.rb,
lib/aptible/resource/default_retry_coordinator.rb

Defined Under Namespace

Classes: Adapter, Base, Boolean, DefaultRetryCoordinator, Errors, NullRetryCoordinator

Constant Summary collapse

RETRY_COORDINATOR_OVERRIDE =
:override_retry_coordinator_class
VERSION =
'1.0.1'.freeze

Class Method Summary collapse

Class Method Details

.override_retry_coordinator_class(klass) ⇒ Object



30
31
32
33
34
35
# File 'lib/aptible/resource.rb', line 30

def override_retry_coordinator_class(klass)
  Thread.current[RETRY_COORDINATOR_OVERRIDE] = klass
  yield if block_given?
ensure
  Thread.current[RETRY_COORDINATOR_OVERRIDE] = nil
end

.retry_coordinator_classObject



37
38
39
40
41
# File 'lib/aptible/resource.rb', line 37

def retry_coordinator_class
  override = Thread.current[RETRY_COORDINATOR_OVERRIDE]
  return override if override
  configuration.retry_coordinator_class
end

.without_retry(&block) ⇒ Object



24
25
26
27
28
# File 'lib/aptible/resource.rb', line 24

def without_retry(&block)
  override_retry_coordinator_class(
    Aptible::Resource::NullRetryCoordinator, &block
  )
end