Class: Pecorino::LeakyBucket::State

Inherits:
Object
  • Object
show all
Defined in:
lib/pecorino/leaky_bucket.rb

Overview

Returned from ‘.state` and `.fillup`

Direct Known Subclasses

ConditionalFillupResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, is_full) ⇒ State

Returns a new instance of State.



30
31
32
33
# File 'lib/pecorino/leaky_bucket.rb', line 30

def initialize(level, is_full)
  @level = level.to_f
  @full = !!is_full
end

Instance Attribute Details

#levelFloat (readonly)

Returns the level of the bucket

Returns:

  • (Float)


37
38
39
# File 'lib/pecorino/leaky_bucket.rb', line 37

def level
  @level
end

Instance Method Details

#full?Boolean Also known as: full

Tells whether the bucket was detected to be full when the operation on the LeakyBucket was performed.

Returns:

  • (Boolean)


42
43
44
# File 'lib/pecorino/leaky_bucket.rb', line 42

def full?
  @full
end