Class: Fusuma::Plugin::Buffers::Buffer
- Inherits:
-
Fusuma::Plugin::Base
- Object
- Fusuma::Plugin::Base
- Fusuma::Plugin::Buffers::Buffer
- Defined in:
- lib/fusuma/plugin/buffers/buffer.rb
Overview
buffer events and output
Direct Known Subclasses
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Instance Method Summary collapse
-
#buffer(event) ⇒ Object
: (Fusuma::Plugin::Events::Event) -> Array?.
-
#clear ⇒ Object
clear buffer : () -> void.
-
#clear_expired(current_time: Time.now) ⇒ Object
clear old events.
-
#empty? ⇒ TrueClass, FalseClass
: () -> bool.
-
#initialize(*args) ⇒ Buffer
constructor
: (*nil | Array) -> void.
-
#source ⇒ Object
Set source for tag from config.yml.
-
#type ⇒ String
: () -> String.
Methods inherited from Fusuma::Plugin::Base
#config_index, #config_param_types, #config_params, inherited, plugins, #shutdown
Constructor Details
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
16 17 18 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 16 def events @events end |
Instance Method Details
#buffer(event) ⇒ Object
: (Fusuma::Plugin::Events::Event) -> Array?
26 27 28 29 30 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 26 def buffer(event) return if event&.tag != source @events.push(event) end |
#clear ⇒ Object
clear buffer : () -> void
45 46 47 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 45 def clear @events.clear end |
#clear_expired(current_time: Time.now) ⇒ Object
clear old events
34 35 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 34 def clear_expired(current_time: Time.now) end |
#empty? ⇒ TrueClass, FalseClass
: () -> bool
39 40 41 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 39 def empty? @events.empty? end |
#source ⇒ Object
Set source for tag from config.yml. DEFAULT_SOURCE is defined in each plugins. : () -> String
52 53 54 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 52 def source @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE) end |
#type ⇒ String
: () -> String
20 21 22 |
# File 'lib/fusuma/plugin/buffers/buffer.rb', line 20 def type @type ||= self.class.name.underscore.split("/").last.gsub("_buffer", "") end |