lib/registry.rb in regstry-1.0.14 vs lib/registry.rb in regstry-1.0.15
- old
+ new
@@ -73,15 +73,17 @@
base.instance_variable_set(:@registries, Registries.new)
end
end
module ClassMethods
- attr_reader :registry_key
+ attr_reader :registry_key, :registry_keys
def register(*args)
obj = !(args.last.is_a?(Symbol) || args.last.is_a?(String)) ? args.pop : self
- args.reverse.map(&:to_sym).each do |key|
+ keys = args.map(&:to_sym)
+ obj.instance_variable_set(:@registry_keys, keys)
+ keys.reverse.each do |key|
obj.instance_variable_set(:@registry_key, key)
registry[key] = obj
end
self
end
@@ -118,9 +120,13 @@
end
module InstanceMethods
def registry_key
self.class.registry_key
+ end
+
+ def registry_keys
+ self.class.registry_keys
end
def registry_name
self.class.registry_name
end