lib/mad_id.rb in mad_id-0.2.0 vs lib/mad_id.rb in mad_id-0.3.0
- old
+ new
@@ -11,15 +11,21 @@
extend ActiveSupport::Concern
@registry = {}
class << self
attr_accessor :registry
+
+ def locate(id)
+ prefix, _ = id.split('-', 2)
+ registry[prefix].find_by_mad_id!(id)
+ end
end
included do
def self.identify_with(value)
@identifier = value
MadID.registry[value.to_s] = self
self.send(:include, MadID::IdentityMethods)
+ self.extend(MadID::FinderMethods)
end
end
end