Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/xstring.rb

Instance Method Summary collapse

Instance Method Details

#to_classObject

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