diff options
author | Andrew Radev <andrey.radev@gmail.com> | 2011-05-27 14:04:39 +0300 |
---|---|---|
committer | Andrew Radev <andrey.radev@gmail.com> | 2011-05-27 14:04:39 +0300 |
commit | c9cc36bde9f779c917171e7c378285b57f748414 (patch) | |
tree | 7cafd42a31275b177367545aa2a378ae9283dffb /activesupport/lib | |
parent | d1c74706c35b0b17b22c4b2541353d1b9ac6bfa5 (diff) | |
download | rails-c9cc36bde9f779c917171e7c378285b57f748414.tar.gz rails-c9cc36bde9f779c917171e7c378285b57f748414.tar.bz2 rails-c9cc36bde9f779c917171e7c378285b57f748414.zip |
Fixes minor ruby 1.8 inconsistency
ActiveSupport::OrderedHash did not behave identically to Hash when given
a block with a splat.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/ordered_hash.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index 762a64a881..68f4bd66da 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -158,7 +158,11 @@ module ActiveSupport self end - alias_method :each_pair, :each + def each_pair + return to_enum(:each_pair) unless block_given? + @keys.each {|key| yield key, self[key]} + self + end alias_method :select, :find_all |