class Fluent::Registry

Constants

DEFAULT_PLUGIN_PATH
FLUENT_LIB_PATH

Attributes

dir_search_prefix[R]
kind[R]
map[R]
paths[R]

Public Class Methods

new(kind, search_prefix, dir_search_prefix: nil) click to toggle source
# File lib/fluent/registry.rb, line 24
def initialize(kind, search_prefix, dir_search_prefix: nil)
  @kind = kind
  @search_prefix = search_prefix
  @dir_search_prefix = dir_search_prefix
  @map = {}
  @paths = []
end

Public Instance Methods

lookup(type) click to toggle source
# File lib/fluent/registry.rb, line 39
def lookup(type)
  type = type.to_sym
  if value = @map[type]
    return value
  end
  search(type)
  if value = @map[type]
    return value
  end
  raise NotFoundPluginError.new("Unknown #{@kind} plugin '#{type}'. Run 'gem search -rd fluent-plugin' to find plugins",
                                kind: @kind, type: type)
end
register(type, value) click to toggle source
# File lib/fluent/registry.rb, line 34
def register(type, value)
  type = type.to_sym
  @map[type] = value
end
reverse_lookup(value) click to toggle source
# File lib/fluent/registry.rb, line 52
def reverse_lookup(value)
  @map.each do |k, v|
    return k if v == value
  end
  nil
end