Module: Fluent::Compat::PropagateDefault::ClassMethods

Defined in:
lib/fluent/compat/propagate_default.rb

Constant Summary collapse

CONFIGURABLE_CLASS_METHODS =
Fluent::Configurable::ClassMethods

Instance Method Summary collapse

Instance Method Details

#config_param(name, type = nil, **kwargs, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fluent/compat/propagate_default.rb', line 35

def config_param(name, type = nil, **kwargs, &block)
  CONFIGURABLE_CLASS_METHODS.instance_method(:config_param).bind_call(self, name, type, **kwargs, &block)
  pparams = propagate_default_params
  if kwargs.has_key?(:default) && pparams[name.to_s]
    newer = pparams[name.to_s].to_sym
    overridden_default_value = kwargs[:default]

    CONFIGURABLE_CLASS_METHODS.instance_method(:config_section).bind_call(self, :buffer) do
      config_set_default newer, overridden_default_value
    end
  end
end

#config_set_default(name, defval) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fluent/compat/propagate_default.rb', line 48

def config_set_default(name, defval)
  CONFIGURABLE_CLASS_METHODS.instance_method(:config_set_default).bind_call(self, name, defval)
  pparams = propagate_default_params
  if pparams[name.to_s]
    newer = pparams[name.to_s].to_sym

    CONFIGURABLE_CLASS_METHODS.instance_method(:config_section).bind_call(self, :buffer) do
      self.config_set_default newer, defval
    end
  end
end