Module: Animoto::Support::DynamicClassLoader
- Included in:
- HTTPEngines, ResponseParsers
- Defined in:
- lib/animoto/support/dynamic_class_loader.rb
Instance Method Summary collapse
-
#[](name) ⇒ Class
Retrieves the adapter class that the name corresponds to.
Instance Method Details
#[](name) ⇒ Class
Retrieves the adapter class that the name corresponds to. The name is case- and punctuation-insensitive, meaning “SomeModule”, “some_module”, and “somemodule” are all treated as the same.
Note that classes defined as an #adapter for this module will be autoloaded upon successful reference, so there’s no need to ensure that the file defining the class is already loaded when calling this method.
16 17 18 19 20 21 22 |
# File 'lib/animoto/support/dynamic_class_loader.rb', line 16 def [] name if klass = adapter_map[normalize_const_name(name)] const_get(klass) else raise NameError, "uninitialized constant #{self.name}::#{name}" end end |