# File lib/inflecto.rb, line 116 def self.constantize(input) names = input.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| # Ruby 1.9 introduces an inherit argument for Module#const_get and # #const_defined? and changes their default behavior. if Module.method(:const_get).arity == 1 constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) else constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name) end end constant end