Sha256: 8d6d50c2bf989c09d11f07e38a52d787fc9d4fe8af09cccc0a356ccb435eb1fb

Contents?: true

Size: 532 Bytes

Versions: 5

Compression:

Stored size: 532 Bytes

Contents

# frozen_string_literal: true

module Fusuma
  module Plugin
    module Buffers
      # Buffer events having KeypressRecord
      class AppmatcherBuffer < Buffer
        DEFAULT_SOURCE = "appmatcher_input"

        # @param event [Event]
        def buffer(event)
          return if event&.tag != source

          @events.push(event)
        end

        def clear_expired(*)
          @events = [@events.last] if @events.size > 100
        end

        def empty?
          @events.empty?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fusuma-plugin-appmatcher-0.7.1 lib/fusuma/plugin/buffers/appmatcher_buffer.rb
fusuma-plugin-appmatcher-0.7.0 lib/fusuma/plugin/buffers/appmatcher_buffer.rb
fusuma-plugin-appmatcher-0.6.1 lib/fusuma/plugin/buffers/appmatcher_buffer.rb
fusuma-plugin-appmatcher-0.6.0 lib/fusuma/plugin/buffers/appmatcher_buffer.rb
fusuma-plugin-appmatcher-0.5.0 lib/fusuma/plugin/buffers/appmatcher_buffer.rb