Module: CodyRobbins::ToClass
- Defined in:
- lib/cody_robbins/to_class.rb
Instance Method Summary collapse
-
#to_class ⇒ Class
Converts the object in question to Camel case and then tries to find a declared constant with the corresponding name.
Instance Method Details
#to_class ⇒ Class
Converts the object in question to Camel case and then tries to find a declared constant with the corresponding name. This combines the functionality of ActiveSupport’s camelize
and constantize
methods, and allows you to easily get a class from its name with one simple method invokation.
14 15 16 |
# File 'lib/cody_robbins/to_class.rb', line 14 def to_class to_s.camelize.constantize end |