Skip to content

Commit

Permalink
Move constantize from conversions to inflections.
Browse files Browse the repository at this point in the history
This removes ActiveModel dependency on TZInfo.

[#4979 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
spastorino authored and josevalim committed Jun 26, 2010
1 parent df083b4 commit 51be8db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion activemodel/lib/active_model/observing.rb
Expand Up @@ -2,7 +2,6 @@
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
Expand Down
11 changes: 0 additions & 11 deletions activesupport/lib/active_support/core_ext/string/conversions.rb
Expand Up @@ -47,15 +47,4 @@ def to_datetime
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
11 changes: 11 additions & 0 deletions activesupport/lib/active_support/core_ext/string/inflections.rb
Expand Up @@ -28,6 +28,17 @@ def singularize
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.
#
Expand Down

0 comments on commit 51be8db

Please sign in to comment.