diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-06-26 15:40:14 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-26 20:49:30 +0200 |
commit | 51be8dbdedd1279d74cd7a7e277c5042f278b8a2 (patch) | |
tree | 8199162aec2e4f340b2329fdde4cc7324e01be9d | |
parent | df083b482d3f22aebb5e48e608811a740037d2aa (diff) | |
download | rails-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>
3 files changed, 11 insertions, 12 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index 14f8bf72dc..d0f36ce3b1 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -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 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. # |