Flowdock
method

safe_constantize

Importance_1
v3.2.1 - Show latest stable - 0 notes - Class: String
safe_constantize() public

safe_constantize tries to find a declared constant with the name specified in the string. It returns nil when the name is not in CamelCase or is not initialized. See ActiveSupport::Inflector.safe_constantize

Examples

"Module".safe_constantize  # => Module
"Class".safe_constantize   # => Class
"blargle".safe_constantize # => nil
Show source
Register or log in to add new notes.