Permalink
Browse files

Fix Struct#each and Struct#each_pair to return self instead of an array.

  • Loading branch information...
1 parent c8fe415 commit 692ee3ecd2d1b9eb200821efffda90cd768b20be @szimek committed Mar 26, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 kernel/common/struct.rb
View
@@ -259,11 +259,13 @@ def eql?(other)
def each(&block)
return to_enum :each unless block_given?
values.each(&block)
+ self
end
def each_pair
return to_enum :each_pair unless block_given?
_attrs.map { |var| yield var, instance_variable_get(:"@#{var}") }
+ self
end
##
@@ -388,4 +390,3 @@ def values_at(*args)
to_a.values_at(*args)
end
end
-

0 comments on commit 692ee3e

Please sign in to comment.