Module: CircuitB

Defined in:
lib/circuit_b.rb,
lib/circuit_b/fuse.rb,
lib/circuit_b/storage/base.rb,
lib/circuit_b/configuration.rb,
lib/circuit_b/storage/redis.rb,
lib/circuit_b/storage/memory.rb

Defined Under Namespace

Modules: Storage Classes: Configuration, FastFailure, Fuse

Class Method Summary collapse

Class Method Details

.configurationObject



13
14
15
# File 'lib/circuit_b.rb', line 13

def self.configuration
  @configuration ||= CircuitB::Configuration.new
end

.configure(&block) ⇒ Object



9
10
11
# File 'lib/circuit_b.rb', line 9

def self.configure(&block)
  block.call(configuration)
end

.fuse(name, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/circuit_b.rb', line 21

def self.fuse(name, &block)
  raise "Fuse with the name '#{name}' is not registered" unless fuse = configuration.fuses[name]
  
  if block
    fuse.wrap(&block)
  else
    return fuse
  end
end

.reset_configurationObject



17
18
19
# File 'lib/circuit_b.rb', line 17

def self.reset_configuration
  @configuration = nil
end