aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-08-25 06:01:02 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-08-25 06:01:02 +0000
commit4dc464c1dfdba2241b54ccd60884e812db664d7c (patch)
treefa50068dfe6bdd4306f194b677980571d48fb44f /activesupport/lib
parentee2397036fc8d4a9498617349fb391389d8bb933 (diff)
downloadrails-4dc464c1dfdba2241b54ccd60884e812db664d7c.tar.gz
rails-4dc464c1dfdba2241b54ccd60884e812db664d7c.tar.bz2
rails-4dc464c1dfdba2241b54ccd60884e812db664d7c.zip
Use Array#assoc in ActiveSupport::OrderedHash.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/ordered_options.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index 0704549ce0..78d699cdf4 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -2,7 +2,7 @@
module ActiveSupport
class OrderedHash < Array #:nodoc:
def []=(key, value)
- if pair = find_pair(key)
+ if pair = assoc(key)
pair.pop
pair << value
else
@@ -11,7 +11,7 @@ module ActiveSupport
end
def [](key)
- pair = find_pair(key)
+ pair = assoc(key)
pair ? pair.last : nil
end
@@ -22,12 +22,6 @@ module ActiveSupport
def values
collect { |key, value| value }
end
-
- private
- def find_pair(key)
- self.each { |i| return i if i.first == key }
- return false
- end
end
end