mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
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:
committed by
José Valim
parent
df083b482d
commit
51be8dbded
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user