Class: Hiatus::CountThreshold
- Inherits:
-
Object
- Object
- Hiatus::CountThreshold
- Defined in:
- lib/hiatus/count_threshold.rb
Direct Known Subclasses
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize(threshold = 5) ⇒ CountThreshold
constructor
A new instance of CountThreshold.
- #reached? ⇒ Boolean
- #reset ⇒ Object
- #touch ⇒ Object
Constructor Details
#initialize(threshold = 5) ⇒ CountThreshold
Returns a new instance of CountThreshold.
4 5 6 7 |
# File 'lib/hiatus/count_threshold.rb', line 4 def initialize(threshold = 5) @threshold = threshold @failure_count = 0 end |
Instance Method Details
#increment ⇒ Object
9 10 11 |
# File 'lib/hiatus/count_threshold.rb', line 9 def increment @failure_count += 1 end |
#reached? ⇒ Boolean
13 14 15 |
# File 'lib/hiatus/count_threshold.rb', line 13 def reached? @failure_count >= @threshold end |
#reset ⇒ Object
17 18 19 |
# File 'lib/hiatus/count_threshold.rb', line 17 def reset @failure_count = 0 end |
#touch ⇒ Object
21 |
# File 'lib/hiatus/count_threshold.rb', line 21 def touch; end |