aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-06-26 15:40:14 -0300
committerJosé Valim <jose.valim@gmail.com>2010-06-26 20:49:30 +0200
commit51be8dbdedd1279d74cd7a7e277c5042f278b8a2 (patch)
tree8199162aec2e4f340b2329fdde4cc7324e01be9d /activesupport/lib/active_support/core_ext
parentdf083b482d3f22aebb5e48e608811a740037d2aa (diff)
downloadrails-51be8dbdedd1279d74cd7a7e277c5042f278b8a2.tar.gz
rails-51be8dbdedd1279d74cd7a7e277c5042f278b8a2.tar.bz2
rails-51be8dbdedd1279d74cd7a7e277c5042f278b8a2.zip
Move constantize from conversions to inflections.
This removes ActiveModel dependency on TZInfo. [#4979 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/string/conversions.rb11
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb11
2 files changed, 11 insertions, 11 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb
index cd7a42ed2b..6a243fe982 100644
--- a/activesupport/lib/active_support/core_ext/string/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/string/conversions.rb
@@ -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
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index ef479d559e..66c4034781 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -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.
#