lib/ddplugin/registry.rb in ddplugin-0.1 vs lib/ddplugin/registry.rb in ddplugin-1.0.0
- old
+ new
@@ -1,24 +1,20 @@
-# encoding: utf-8
-
module DDPlugin
-
# The registry is responsible for keeping track of all loaded plugins.
class Registry
-
# Returns the shared {DDPlugin::Registry} instance, creating it if none
# exists yet.
#
# @return [DDPlugin::Registry] The shared plugin registry
def self.instance
- @instance ||= self.new
+ @instance ||= new
end
# @api private
def initialize
- @identifiers_to_classes = Hash.new { |h,k| h[k] = {}.dup }
- @classes_to_identifiers = Hash.new { |h,k| h[k] = {}.dup }
+ @identifiers_to_classes = Hash.new { |h, k| h[k] = {}.dup }
+ @classes_to_identifiers = Hash.new { |h, k| h[k] = {}.dup }
end
# Registers the given class as a plugin.
#
# @param [Class] root_class The root class of the class to register
@@ -68,9 +64,7 @@
# @return [Enumerable<Class>] A collection of registered classes
def find_all(root_class)
@identifiers_to_classes[root_class] ||= {}
@identifiers_to_classes[root_class].values
end
-
end
-
end