Class: Breaker::InMemoryRepo::Fuse

Inherits:
Struct
  • Object
show all
Defined in:
lib/breaker/in_memory_repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Fuse

Returns a new instance of Fuse.



4
5
6
7
8
9
10
11
12
13
# File 'lib/breaker/in_memory_repo.rb', line 4

def initialize(*args)
  super

  self.failure_threshold ||= 10
  self.retry_timeout ||= 60
  self.timeout ||= 5

  self.state ||= :closed
  self.failure_count ||= 0
end

Instance Attribute Details

#failure_countObject

Returns the value of attribute failure_count

Returns:

  • (Object)

    the current value of failure_count



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def failure_count
  @failure_count
end

#failure_thresholdObject

Returns the value of attribute failure_threshold

Returns:

  • (Object)

    the current value of failure_threshold



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def failure_threshold
  @failure_threshold
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def name
  @name
end

#retry_thresholdObject

Returns the value of attribute retry_threshold

Returns:

  • (Object)

    the current value of retry_threshold



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def retry_threshold
  @retry_threshold
end

#retry_timeoutObject

Returns the value of attribute retry_timeout

Returns:

  • (Object)

    the current value of retry_timeout



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def retry_timeout
  @retry_timeout
end

#stateObject

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def state
  @state
end

#timeoutObject

Returns the value of attribute timeout

Returns:

  • (Object)

    the current value of timeout



3
4
5
# File 'lib/breaker/in_memory_repo.rb', line 3

def timeout
  @timeout
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/breaker/in_memory_repo.rb', line 15

def ==(other)
  other.instance_of?(self.class) && name == other.name
end