Class: Fusuma::Plugin::Detectors::Detector
- Inherits:
-
Base
- Object
- Base
- Fusuma::Plugin::Detectors::Detector
show all
- Defined in:
- lib/fusuma/plugin/detectors/detector.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#config_index, #config_param_types, #config_params, inherited, plugins
#fork
Class Method Details
.tag ⇒ Object
55
56
57
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 55
def tag
name.split('Detectors::').last.underscore
end
|
.type(tag_name = tag) ⇒ Object
59
60
61
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 59
def type(tag_name = tag)
tag_name.gsub('_detector', '')
end
|
Instance Method Details
33
34
35
36
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 33
def create_event(record:)
@last_time = Time.now
Events::Event.new(time: @last_time, tag: tag, record: record)
end
|
#detect(_buffers) ⇒ Event, NilClass
25
26
27
28
29
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 25
def detect(_buffers)
raise NotImplementedError, "override #{self.class.name}##{__method__}"
end
|
#first_time? ⇒ Boolean
42
43
44
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 42
def first_time?
@last_time.nil?
end
|
#last_time ⇒ Object
38
39
40
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 38
def last_time
@last_time ||= Time.now
end
|
#sources ⇒ Array<String>
12
13
14
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 12
def sources
@source ||= self.class.const_get('SOURCES')
end
|
#tag ⇒ Object
46
47
48
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 46
def tag
self.class.tag
end
|
#type ⇒ Object
50
51
52
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 50
def type
self.class.type
end
|
#watch? ⇒ TrueClass, FalseClass
Always watch buffers and detect them or not
18
19
20
|
# File 'lib/fusuma/plugin/detectors/detector.rb', line 18
def watch?
false
end
|