class Topaz::Clock::EventTrigger

Trigger clock events

Public Class Methods

new() click to toggle source
# File lib/topaz/clock.rb, line 96
def initialize
  @stop = []
end

Public Instance Methods

stop(&callback) click to toggle source

Pass in a callback which will stop the clock if it evaluates to true @param [Proc] callback @return [Array<Proc>]

# File lib/topaz/clock.rb, line 103
def stop(&callback)
  if block_given?
    @stop.clear
    @stop << callback
  end
  @stop
end
stop?() click to toggle source

Should the stop event be triggered? @return [Boolean]

# File lib/topaz/clock.rb, line 113
def stop?
  !@stop.nil? && @stop.any?(&:call)
end