class Yao::Plugins::Registry
Public Class Methods
new()
click to toggle source
@return [Hash]
# File lib/yao/plugins/registry.rb, line 10 def initialize @types = {} end
Public Instance Methods
[](type)
click to toggle source
@param type [Symbol] @return [Object]
# File lib/yao/plugins/registry.rb, line 16 def [](type) @types[type] end
register(klass, type: nil, name: :default)
click to toggle source
@param klass [*] @param type [Symbol] @param name [Symbol]
# File lib/yao/plugins/registry.rb, line 23 def register(klass, type: nil, name: :default) raise("Plugin registration requires both type and name.") if !type or !name @types[type] ||= {} @types[type][name] = klass end