Method: Juke::Ext::Utils#constantize
- Defined in:
- lib/juke/ext/utils.rb
#constantize(camel_cased_word) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/juke/ext/utils.rb', line 16 def constantize(camel_cased_word) unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!" end Object.module_eval("::#{$1}", __FILE__, __LINE__) end |