Sha256: 4a62d953e88516b744d830a8027dce9953deda4cbd64b411919084e7f9958685
Contents?: true
Size: 772 Bytes
Versions: 6
Compression:
Stored size: 772 Bytes
Contents
# frozen_string_literal: true module Fusuma module Plugin module Buffers # Buffer events having KeypressRecord class KeypressBuffer < Buffer DEFAULT_SOURCE = 'keypress_parser' # @param event [Event] def buffer(event) return if event&.tag != source @events.push(event) end def clear_expired(*) return if @events.empty? return unless released? released_code = @events.last.record.code @events.delete_if { |e| e.record.code == released_code } end def empty? @events.empty? end private def released? true if @events.last.record.status =~ /released/ end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems