Module: Noumenon::StringExtensions
- Defined in:
- lib/noumenon/string_extensions.rb
Overview
Adds some additional methods to String objects.
Instance Method Summary collapse
-
#constantize ⇒ Object
Attempts to convert a string into a constant.
Instance Method Details
#constantize ⇒ Object
Attempts to convert a string into a constant.
If the constant could not be found then a NameError will be raised.
11 12 13 14 15 16 17 18 |
# File 'lib/noumenon/string_extensions.rb', line 11 def constantize mod = Module split("::").each do |mod_name| mod = mod.const_get(mod_name.to_sym) end mod end |