aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/ordered_hash.rb
diff options
context:
space:
mode:
authorGabriel Horner <gabriel.horner@gmail.com>2011-02-02 23:35:54 -0500
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-03 19:26:36 -0200
commitc0b4db0c28465866b656c894c16ce35f4d313a12 (patch)
tree33ac3b7e0783c70eb8e9da8dd1672cce13d04b0d /activesupport/lib/active_support/ordered_hash.rb
parentbca070ef2ddbbe7e093c340ec7722e4dca0f37a5 (diff)
downloadrails-c0b4db0c28465866b656c894c16ce35f4d313a12.tar.gz
rails-c0b4db0c28465866b656c894c16ce35f4d313a12.tar.bz2
rails-c0b4db0c28465866b656c894c16ce35f4d313a12.zip
fix OrderedHash#each* methods to return Enumerators when called without a block [#6366 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/lib/active_support/ordered_hash.rb')
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index b2f04b427b..fbc40d1b69 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -137,16 +137,19 @@ module ActiveSupport
end
def each_key
+ return to_enum(:each_key) unless block_given?
@keys.each { |key| yield key }
self
end
def each_value
+ return to_enum(:each_value) unless block_given?
@keys.each { |key| yield self[key]}
self
end
def each
+ return to_enum(:each) unless block_given?
@keys.each {|key| yield [key, self[key]]}
self
end