diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-15 01:45:35 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-15 01:45:35 +0000 |
commit | b1999be5a7efd67e2602c37ed898aa8433661863 (patch) | |
tree | 03bc833276075d802d0ce0ad261baed3d7232533 /activesupport/lib/core_ext | |
parent | 88a3343ed57c01ca358da8473d15fc4d2b4a5bff (diff) | |
download | rails-b1999be5a7efd67e2602c37ed898aa8433661863.tar.gz rails-b1999be5a7efd67e2602c37ed898aa8433661863.tar.bz2 rails-b1999be5a7efd67e2602c37ed898aa8433661863.zip |
A hopefully more successful attempt at the Routing branch merge
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@617 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/core_ext')
-rw-r--r-- | activesupport/lib/core_ext/hash/indifferent_access.rb | 10 | ||||
-rw-r--r-- | activesupport/lib/core_ext/string/inflections.rb | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/activesupport/lib/core_ext/hash/indifferent_access.rb b/activesupport/lib/core_ext/hash/indifferent_access.rb index 3fe0999866..2353cfaf3b 100644 --- a/activesupport/lib/core_ext/hash/indifferent_access.rb +++ b/activesupport/lib/core_ext/hash/indifferent_access.rb @@ -8,17 +8,17 @@ class HashWithIndifferentAccess < Hash end end - alias_method :regular_read, :[] + alias_method :regular_reader, :[] unless method_defined?(:regular_reader) def [](key) case key - when Symbol: regular_read(key) || regular_read(key.to_s) - when String: regular_read(key) || regular_read(key.to_sym) - else regular_read(key) + when Symbol: regular_reader(key) || regular_reader(key.to_s) + when String: regular_reader(key) || regular_reader(key.to_sym) + else regular_reader(key) end end - alias_method :regular_writer, :[]= + alias_method :regular_writer, :[]= unless method_defined?(:regular_writer) def []=(key, value) regular_writer(key.is_a?(String) ? key.to_sym : key, value) diff --git a/activesupport/lib/core_ext/string/inflections.rb b/activesupport/lib/core_ext/string/inflections.rb index 5d1070b00a..aa4ff3a74d 100644 --- a/activesupport/lib/core_ext/string/inflections.rb +++ b/activesupport/lib/core_ext/string/inflections.rb @@ -39,6 +39,10 @@ module ActiveSupport #:nodoc: def foreign_key(separate_class_name_and_id_with_underscore = true) Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) end + + def constantize + Inflector.constantize(self) + end end end end |