Flowdock
method

safe_constantize

Importance_1
Ruby on Rails latest stable (v4.0.2) - 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

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