Class: Fluent::Plugin::ConfigExpanderOutput
- Inherits:
-
BareOutput
- Object
- BareOutput
- Fluent::Plugin::ConfigExpanderOutput
show all
- Defined in:
- lib/fluent/plugin/out_config_expander.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
49
50
51
|
# File 'lib/fluent/plugin/out_config_expander.rb', line 49
def method_missing(name, *args, &block)
@plugin.__send__(name, *args, &block)
end
|
Instance Method Details
#builtin_mapping ⇒ Object
22
23
24
|
# File 'lib/fluent/plugin/out_config_expander.rb', line 22
def builtin_mapping
{'__hostname__' => @hostname, '__HOSTNAME__' => @hostname, '${hostname}' => @hostname, '${HOSTNAME}' => @hostname}
end
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/fluent/plugin/out_config_expander.rb', line 33
def configure(conf)
super
ex = expand_config(@config_config.corresponding_config_element)
type = ex['@type']
@plugin = Fluent::Plugin.new_output(type)
@plugin.context_router = self.event_emitter_router(conf['@label'])
@plugin.configure(ex)
mark_used(@config_config.corresponding_config_element)
self.extend SingleForwardable
override_methods = self.methods + @plugin.methods - SingleForwardable.instance_methods - Object.instance_methods
override_methods.uniq!
def_delegators(:@plugin, *override_methods)
end
|
#expand_config(conf) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/fluent/plugin/out_config_expander.rb', line 26
def expand_config(conf)
ex = Fluent::Config::Expander.expand(conf, builtin_mapping())
ex.name = 'match'
ex.arg = conf.arg
ex
end
|
#mark_used(conf) ⇒ Object
17
18
19
20
|
# File 'lib/fluent/plugin/out_config_expander.rb', line 17
def mark_used(conf)
conf.keys.each {|key| conf[key] }
conf.elements.each{|e| mark_used(e)}
end
|