diff options
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/ordered_options.rb | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 77f0a57bdb..d35191717d 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Use Array#assoc in ActiveSupport::OrderedHash. [Mauricio Fernandez] + * Greatly increased performance of String.to_json, which speeds up RJS considerably on large pages, fixes #3473 [Shugo Maeda] * Detect missing_constants calls from removed modules and fail accordingly. [Nicholas Seckar] 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 |