Module: Fluent::PluginHelper

Defined in:
lib/fluent/plugin_helper.rb,
lib/fluent/plugin_helper/timer.rb,
lib/fluent/plugin_helper/inject.rb,
lib/fluent/plugin_helper/parser.rb,
lib/fluent/plugin_helper/server.rb,
lib/fluent/plugin_helper/socket.rb,
lib/fluent/plugin_helper/thread.rb,
lib/fluent/plugin_helper/extract.rb,
lib/fluent/plugin_helper/storage.rb,
lib/fluent/plugin_helper/formatter.rb,
lib/fluent/plugin_helper/event_loop.rb,
lib/fluent/plugin_helper/cert_option.rb,
lib/fluent/plugin_helper/retry_state.rb,
lib/fluent/plugin_helper/child_process.rb,
lib/fluent/plugin_helper/event_emitter.rb,
lib/fluent/plugin_helper/socket_option.rb,
lib/fluent/plugin_helper/record_accessor.rb,
lib/fluent/plugin_helper/compat_parameters.rb

Defined Under Namespace

Modules: CertOption, ChildProcess, CompatParameters, EventEmitter, EventLoop, Extract, Formatter, Inject, Mixin, Parser, RecordAccessor, RetryState, Server, Socket, SocketOption, Storage, Thread, Timer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(mod) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/fluent/plugin_helper.rb', line 41

def self.extended(mod)
  def mod.inherited(subclass)
    subclass.module_eval do
      @_plugin_helpers_list = []
    end
  end
end

Instance Method Details

#helpers(*snake_case_symbols) ⇒ Object



61
62
63
64
65
# File 'lib/fluent/plugin_helper.rb', line 61

def helpers(*snake_case_symbols)
  @_plugin_helpers_list ||= []
  @_plugin_helpers_list.concat(snake_case_symbols)
  helpers_internal(*snake_case_symbols)
end

#helpers_internal(*snake_case_symbols) ⇒ Object



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

def helpers_internal(*snake_case_symbols)
  helper_modules = []
  snake_case_symbols.each do |name|
    begin
      helper_modules << Fluent::PluginHelper.const_get(name.to_s.split('_').map(&:capitalize).join)
    rescue NameError
      raise "Unknown plugin helper:#{name}"
    end
  end
  include(*helper_modules)
end

#plugin_helpersObject



67
68
69
# File 'lib/fluent/plugin_helper.rb', line 67

def plugin_helpers
  @_plugin_helpers_list || []
end