Module: ConstantCache
- Defined in:
- lib/constant_cache/version.rb,
lib/constant_cache/cache_methods.rb
Defined Under Namespace
Modules: ClassMethods, Version Classes: DuplicateConstantError
Constant Summary collapse
- CHARACTER_LIMIT =
64
Class Method Summary collapse
Instance Method Summary collapse
-
#set_instance_as_constant ⇒ Object
Create a constant on the class that pointing to an instance.
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/constant_cache/cache_methods.rb', line 5 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#set_instance_as_constant ⇒ Object
Create a constant on the class that pointing to an instance
61 62 63 64 65 |
# File 'lib/constant_cache/cache_methods.rb', line 61 def set_instance_as_constant unless constant_name.nil? || self.class.const_defined?(constant_name) self.class.const_set(constant_name, self) end end |