Class: Fluent::VariableStore

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/variable_store.rb

Overview

VariableStore provides all pluigns with the way to shared variable without using class variable it’s for safe reloading mechanism

Class Method Summary collapse

Class Method Details

.fetch_or_build(namespace, default_value: {}) ⇒ Object



24
25
26
# File 'lib/fluent/variable_store.rb', line 24

def fetch_or_build(namespace, default_value: {})
  @data[namespace] ||= default_value
end

.try_to_resetObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/fluent/variable_store.rb', line 28

def try_to_reset
  @data, old = {}, @data

  begin
    yield
  rescue
    @data = old
    raise
  end
end