Class: Rhod::Backoffs::Backoff

Inherits:
Object
  • Object
show all
Defined in:
lib/rhod/backoffs/backoff.rb

Direct Known Subclasses

Constant, Exponential, Logarithmic, Random

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state = nil) ⇒ Backoff

Returns a new instance of Backoff.



4
5
6
# File 'lib/rhod/backoffs/backoff.rb', line 4

def initialize(state = nil)
  @state = state
end

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



2
3
4
# File 'lib/rhod/backoffs/backoff.rb', line 2

def state
  @state
end

Instance Method Details

#iterateObject

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/rhod/backoffs/backoff.rb', line 8

def iterate
  raise NotImplementedError
end

#nextObject



12
13
14
15
# File 'lib/rhod/backoffs/backoff.rb', line 12

def next
  @state, result = iterate(state)
  result
end