Move constantize from conversions to inflections.

This removes ActiveModel dependency on TZInfo.

[#4979 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Santiago Pastorino
2010-06-26 15:40:14 -03:00
committed by José Valim
parent df083b482d
commit 51be8dbded
3 changed files with 11 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ require 'singleton'
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/module/aliasing'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/string/conversions'
module ActiveModel
module Observing

View File

@@ -47,15 +47,4 @@ class String
d[5] += d.pop
::DateTime.civil(*d)
end
# +constantize+ tries to find a declared constant with the name specified
# in the string. It raises a NameError when the name is not in CamelCase
# or is not initialized.
#
# Examples
# "Module".constantize # => Module
# "Class".constantize # => Class
def constantize
ActiveSupport::Inflector.constantize(self)
end
end

View File

@@ -28,6 +28,17 @@ class String
ActiveSupport::Inflector.singularize(self)
end
# +constantize+ tries to find a declared constant with the name specified
# in the string. It raises a NameError when the name is not in CamelCase
# or is not initialized.
#
# Examples
# "Module".constantize # => Module
# "Class".constantize # => Class
def constantize
ActiveSupport::Inflector.constantize(self)
end
# By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
# is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
#