Class: Ferrum::Utils::Event

Inherits:
Concurrent::Event
  • Object
show all
Defined in:
lib/ferrum/utils/event.rb

Overview

A Concurrent::Event subclass that additionally tracks how many times it has been reset, via #iteration.

Instance Method Summary collapse

Instance Method Details

#iterationInteger

Number of times the event has been reset.

Returns:

  • (Integer)


15
16
17
# File 'lib/ferrum/utils/event.rb', line 15

def iteration
  synchronize { @iteration }
end

#resetInteger

Marks the event as unset and increments the iteration counter.

Returns:

  • (Integer)


24
25
26
27
28
29
30
# File 'lib/ferrum/utils/event.rb', line 24

def reset
  synchronize do
    @iteration += 1
    @set = false if @set
    @iteration
  end
end