Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/spanx.rb
Instance Method Summary collapse
Instance Method Details
#constantize ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/spanx.rb', line 30 def constantize camel_cased_word = self 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 |