Class: Fusuma::Plugin::Detectors::AppmatcherDetector
- Inherits:
-
Detector
- Object
- Detector
- Fusuma::Plugin::Detectors::AppmatcherDetector
- Defined in:
- lib/fusuma/plugin/detectors/appmatcher_detector.rb
Overview
Detect KeypressEvent from KeypressBuffer
Constant Summary collapse
- SOURCES =
["appmatcher"].freeze
- BUFFER_TYPE =
"appmatcher"
Instance Method Summary collapse
- #detect(buffers) ⇒ Event, NilClass
-
#watch? ⇒ Boolean
Always watch buffers and detect them.
Instance Method Details
#detect(buffers) ⇒ Event, NilClass
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fusuma/plugin/detectors/appmatcher_detector.rb', line 19 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? ⇒ Boolean
Always watch buffers and detect them.
12 13 14 |
# File 'lib/fusuma/plugin/detectors/appmatcher_detector.rb', line 12 def watch? true end |