Method: String#constantize
- Defined in:
- lib/active_support/core_ext/string/inflections.rb
#constantize ⇒ Object
constantize
tries to find a declared constant with the name specified in the string. It raises a NameError when the name is not in CamelCase or is not initialized.
'Module'.constantize # => Module
'Class'.constantize # => Class
'blargle'.constantize # => NameError: wrong constant name blargle
See ActiveSupport::Inflector.constantize.
73 74 75 |
# File 'lib/active_support/core_ext/string/inflections.rb', line 73 def constantize ActiveSupport::Inflector.constantize(self) end |