Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kpm/formatter.rb
Overview
Extend String to be able to instantiate a object based on its classname
Instance Method Summary collapse
Instance Method Details
#to_class ⇒ Object
3 4 5 6 7 |
# File 'lib/kpm/formatter.rb', line 3 def to_class self.split('::').inject(Kernel) do |mod, class_name| mod.const_get(class_name) end end |