Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/xstring.rb
Instance Method Summary collapse
-
#to_class ⇒ Object
casts a string into a Class if exists or returns nil.
Instance Method Details
#to_class ⇒ Object
casts a string into a Class if exists or returns nil
5 6 7 8 9 |
# File 'lib/xstring.rb', line 5 def to_class klass = Object.const_get(self) klass if klass.class == Class rescue Exception end |