Class: RateLimit::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/ratelimit/bucketbased.rb

Overview

To set bucket parameters easily, you can create named configurations to create buckets using those templates.

The configurations have the following parameters:

  • name

    the name of the configuration

  • start

    the credits that a new bucket starts with

  • max

    the maximum that the bucket will be filled by the regeneration process

  • min

    the minimum that a bucket can go, must be <= 0.

  • refill_amount

    the amount that will be added to the bucket every refill_epoch seconds.

  • refill_epoch

    the number of seconds before the bucket is credited by the regeneration process

Instance Attribute Summary collapse

Instance Attribute Details

#costObject

Returns the value of attribute cost

Returns:

  • (Object)

    the current value of cost



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def cost
  @cost
end

#maxObject

Returns the value of attribute max

Returns:

  • (Object)

    the current value of max



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def max
  @max
end

#minObject

Returns the value of attribute min

Returns:

  • (Object)

    the current value of min



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def min
  @min
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def name
  @name
end

#refill_amountObject

Returns the value of attribute refill_amount

Returns:

  • (Object)

    the current value of refill_amount



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def refill_amount
  @refill_amount
end

#refill_epochObject

Returns the value of attribute refill_epoch

Returns:

  • (Object)

    the current value of refill_epoch



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def refill_epoch
  @refill_epoch
end

#startObject

Returns the value of attribute start

Returns:

  • (Object)

    the current value of start



27
28
29
# File 'lib/ratelimit/bucketbased.rb', line 27

def start
  @start
end