Module: Circuitbox::Configuration
- Included in:
- Circuitbox
- Defined in:
- lib/circuitbox/configuration.rb
Instance Attribute Summary collapse
-
#default_circuit_store ⇒ Circuitbox::MemoryStore, Moneta
Circuit store used by circuits that are not configured with a specific circuit store Defaults to Circuitbox::MemoryStore.
-
#default_notifier ⇒ Circuitbox::Notifier::ActiveSupport, Circuitbox::Notifier::Null
Notifier used by circuits that are not configured with a specific notifier.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|Circuitbox| ... } ⇒ Object
Configure Circuitbox’s defaults After configuring the cached circuits are cleared.
Instance Attribute Details
#default_circuit_store ⇒ Circuitbox::MemoryStore, Moneta
Circuit store used by circuits that are not configured with a specific circuit store Defaults to Circuitbox::MemoryStore
37 38 39 |
# File 'lib/circuitbox/configuration.rb', line 37 def default_circuit_store @default_circuit_store ||= MemoryStore.new end |
#default_notifier ⇒ Circuitbox::Notifier::ActiveSupport, Circuitbox::Notifier::Null
Notifier used by circuits that are not configured with a specific notifier. If ActiveSupport::Notifications is defined it defaults to Circuitbox::Notifier::ActiveSupport Otherwise it defaults to Circuitbox::Notifier::Null
46 47 48 49 50 51 52 |
# File 'lib/circuitbox/configuration.rb', line 46 def default_notifier @default_notifier ||= if defined?(ActiveSupport::Notifications) Notifier::ActiveSupport.new else Notifier::Null.new end end |
Class Method Details
.extended(base) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/circuitbox/configuration.rb', line 12 def self.extended(base) base.instance_eval do @cached_circuits_mutex = Mutex.new @cached_circuits = {} # preload circuit_store because it has no other dependencies default_circuit_store end end |
Instance Method Details
#configure {|Circuitbox| ... } ⇒ Object
Configure Circuitbox’s defaults After configuring the cached circuits are cleared
27 28 29 30 31 |
# File 'lib/circuitbox/configuration.rb', line 27 def configure yield self clear_cached_circuits! nil end |