Class: Quebert::Support::ClassRegistry
- Defined in:
- lib/quebert/support/registry.rb
Overview
Stores classes at retreives a key for class and subclasses. TODO
* make this thing match on most specific subclass
Instance Method Summary collapse
-
#[](key) ⇒ Object
Returns a class from a given instance.
Methods inherited from Registry
Instance Method Details
#[](key) ⇒ Object
Returns a class from a given instance
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/quebert/support/registry.rb', line 18 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 |