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/compat_parameters.rb

Defined Under Namespace

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(mod) ⇒ Object



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

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



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

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



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

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



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

def plugin_helpers
  @_plugin_helpers_list || []
end