Sha256: 7fed9b89bf9b5f0fba97f60a73d3ee2645e79a1ba68fa1702e9ec4ffd0df5fe6
Contents?: true
Size: 846 Bytes
Versions: 26
Compression:
Stored size: 846 Bytes
Contents
module Quebert module Support class Registry < Hash def register(key, val) self[key.to_sym] = val end def unregister(key) self.delete(key.to_sym) end end # Stores classes at retreives a key for class and subclasses. # TODO # * make this thing match on most specific subclass class ClassRegistry < Registry # Returns a class from a given instance def[](key) case key when Class # Find the class key based on the class or subclass of the incoming key/klass if klass = keys.map{|klass| Support.constantize(klass) }.find{|k| k >= key} # If we find a matching class/subclass then pull this out super klass.name.to_sym end else super end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems