Class: Pecorino::LeakyBucket::ConditionalFillupResult
- Defined in:
- lib/pecorino/leaky_bucket.rb
Overview
Same as ‘State` but also communicates whether the write has been permitted or not. A conditional fillup may refuse a write if it would make the bucket overflow
Instance Attribute Summary
Attributes inherited from State
Instance Method Summary collapse
-
#accepted? ⇒ Boolean
Tells whether the bucket did accept the requested fillup.
-
#initialize(level, is_full, accepted) ⇒ ConditionalFillupResult
constructor
A new instance of ConditionalFillupResult.
Methods inherited from State
Constructor Details
#initialize(level, is_full, accepted) ⇒ ConditionalFillupResult
Returns a new instance of ConditionalFillupResult.
52 53 54 55 |
# File 'lib/pecorino/leaky_bucket.rb', line 52 def initialize(level, is_full, accepted) super(level, is_full) @accepted = !!accepted end |
Instance Method Details
#accepted? ⇒ Boolean
Tells whether the bucket did accept the requested fillup
59 60 61 |
# File 'lib/pecorino/leaky_bucket.rb', line 59 def accepted? @accepted end |