class Fusuma::Plugin::Detectors::AppmatcherDetector

Detect KeypressEvent from KeypressBuffer

Constants

BUFFER_TYPE
DEFAULT_NAME
SOURCES

Public Instance Methods

detect(buffers) click to toggle source

@param buffers [Array<Event>] @return [Event] if event is detected @return [NilClass] if event is NOT detected

# File lib/fusuma/plugin/detectors/appmatcher_detector.rb, line 20
def detect(buffers)
  buffer = buffers.find { |b| b.type == BUFFER_TYPE }

  return if buffer.empty?

  record = buffer.events.last.record

  context_record = Events::Records::ContextRecord.new(
    name: 'application',
    value: record.name
  )

  create_event(record: context_record)
end
watch?() click to toggle source

Always watch buffers and detect them.

# File lib/fusuma/plugin/detectors/appmatcher_detector.rb, line 13
def watch?
  true
end