Method: String#constantize
- Defined in:
- lib/strokedb/core_ext/string.rb
#constantize ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/strokedb/core_ext/string.rb', line 33 def constantize if /^meta:/ =~ self return StrokeDB::META_CACHE[Meta.make_uuid_from_fullname(self)] end unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self raise NameError, "#{self.inspect} is not a valid constant name!" end Object.module_eval("::#{$1}", __FILE__, __LINE__) end |