Sha256: 5f204cbd13baff809be6b489906b315d7d580b45626808a5e1fc4595640ded8d
Contents?: true
Size: 448 Bytes
Versions: 34
Compression:
Stored size: 448 Bytes
Contents
require 'singleton' module Yao::Plugins class Registry include Singleton def initialize @types = {} end def [](type) @types[type] end 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 end def self.register(*a) Registry.instance.register(*a) end end
Version data entries
34 entries across 34 versions & 1 rubygems