Module: AntSupport::CoreExtensions::String::Inflections

Included in:
String
Defined in:
lib/ant_support/core_ext/string/inflections.rb

Instance Method Summary collapse

Instance Method Details

#constantizeObject

:nodoc:



26
27
28
29
30
31
32
33
34
35
# File 'lib/ant_support/core_ext/string/inflections.rb', line 26

def constantize
  names = self.split('::')
  names.shift if names.empty? || names.first.empty?

  constant = Object
  names.each do |name|
    constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  end
  constant
end