Class: Hiatus::FileCountThreshold
- Inherits:
-
CountThreshold
- Object
- CountThreshold
- Hiatus::FileCountThreshold
- Defined in:
- lib/hiatus/extras/file_count_threshold.rb
Overview
an example of threshold that could be stored somewhere file’s really simple to implement.
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize(file_path, threshold = 5) ⇒ FileCountThreshold
constructor
A new instance of FileCountThreshold.
- #reached? ⇒ Boolean
- #reset ⇒ Object
Methods inherited from CountThreshold
Constructor Details
#initialize(file_path, threshold = 5) ⇒ FileCountThreshold
Returns a new instance of FileCountThreshold.
5 6 7 8 |
# File 'lib/hiatus/extras/file_count_threshold.rb', line 5 def initialize(file_path, threshold = 5) @file_path = file_path super threshold end |
Instance Method Details
#increment ⇒ Object
10 11 12 13 |
# File 'lib/hiatus/extras/file_count_threshold.rb', line 10 def increment super serialize end |
#reached? ⇒ Boolean
15 16 17 18 |
# File 'lib/hiatus/extras/file_count_threshold.rb', line 15 def reached? failure_count, threshold = *deserialize failure_count >= threshold end |
#reset ⇒ Object
20 21 22 23 |
# File 'lib/hiatus/extras/file_count_threshold.rb', line 20 def reset super serialize end |