class Tumugi::Registry

Constants

DEFAULT_PLUGIN_PATH

Attributes

kind[R]
paths[R]

Public Class Methods

new(kind, search_prefix) click to toggle source
# File lib/tumugi/registry.rb, line 5
def initialize(kind, search_prefix)
  @kind = kind
  @search_prefix = search_prefix
  @map = {}
  @paths = [DEFAULT_PLUGIN_PATH]
end

Public Instance Methods

lookup(type) click to toggle source
# File lib/tumugi/registry.rb, line 19
def lookup(type)
  t = type.to_sym
  return @map[t] if @map.has_key?(t)
  search(type)
  return @map[t] if @map.has_key?(t)
  raise "Unknown #{@kind} plugin '#{type}'"
end
register(type, value) click to toggle source
# File lib/tumugi/registry.rb, line 14
def register(type, value)
  type = type.to_sym
  @map[type] = value
end