Class: Hiatus::CountThreshold

Inherits:
Object
  • Object
show all
Defined in:
lib/hiatus/count_threshold.rb

Direct Known Subclasses

FileCountThreshold

Instance Method Summary collapse

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

#incrementObject



9
10
11
# File 'lib/hiatus/count_threshold.rb', line 9

def increment
  @failure_count += 1
end

#reached?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/hiatus/count_threshold.rb', line 13

def reached?
  @failure_count >= @threshold
end

#resetObject



17
18
19
# File 'lib/hiatus/count_threshold.rb', line 17

def reset
  @failure_count = 0
end

#touchObject



21
# File 'lib/hiatus/count_threshold.rb', line 21

def touch; end