Class: SpeedLimiter::State

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/speed_limiter/state.rb

Overview

Execution status model

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params:, count:, ttl:) ⇒ State

Returns a new instance of State.

Parameters:



14
15
16
17
18
# File 'lib/speed_limiter/state.rb', line 14

def initialize(params:, count:, ttl:)
  @params = params
  @count = count
  @ttl = ttl
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



20
21
22
# File 'lib/speed_limiter/state.rb', line 20

def count
  @count
end

#paramsObject (readonly)

Returns the value of attribute params.



20
21
22
# File 'lib/speed_limiter/state.rb', line 20

def params
  @params
end

#ttlObject (readonly)

Returns the value of attribute ttl.



20
21
22
# File 'lib/speed_limiter/state.rb', line 20

def ttl
  @ttl
end

Instance Method Details

#configObject



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params

#inspectObject Also known as: to_s



36
37
38
# File 'lib/speed_limiter/state.rb', line 36

def inspect
  "<#{self.class.name} key=#{key.inspect} count=#{count} ttl=#{ttl}>"
end

#keyObject

See Also:



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params

#limitObject



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params

#on_throttledObject



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params

#periodObject



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params

#retryObject



34
# File 'lib/speed_limiter/state.rb', line 34

delegate %i[config key limit period on_throttled retry] => :@params