class Fusuma::Plugin::Buffers::TimerBuffer

manage events and generate command

def buffer(event)

Returns:
  • (Buffer, NilClass) -

Parameters:
  • event (Event) --
def buffer(event)
  return if event&.tag != source
  @events.push(event)
  self
end

def clear_expired(current_time: Time.now)

def clear_expired(current_time: Time.now)
  @seconds_to_keep ||= (config_params(:seconds_to_keep) || DEFAULT_SECONDS_TO_KEEP)
  @events.each do |e|
    break if current_time - e.time < @seconds_to_keep
    @events.delete(e)
  end
end

def config_param_types

def config_param_types
  {
    source: [String],
    seconds_to_keep: [Float, Integer]
  }
end

def empty?

def empty?
  @events.empty?
end