Class: String

Inherits:
Object
  • Object
show all
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_classObject



5
6
7
8
9
# File 'lib/kpm/formatter.rb', line 5

def to_class
  split('::').inject(Kernel) do |mod, class_name|
    mod.const_get(class_name)
  end
end