summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-03 14:07:53 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-03 14:07:53 +0000
commitb81e04571299a8e98d3931be9c10b9b63da375a8 (patch)
treee1f673ce9d3b06ab5c58b5dbd76ac3ea32ad71a8 /lib
parent871e9d175e07e364802f00c945cec56ef42084df (diff)
* lib/matrix.rb (Vector#each): Return self and optimization [ruby-core:28405]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 3f27bcaeef..b3a7e79fe5 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -1144,11 +1144,10 @@ class Vector
#
# Iterate over the elements of this vector
#
- def each
+ def each(&block)
return to_enum(:each) unless block_given?
- @elements.each do |i|
- yield i
- end
+ @elements.each(&block)
+ self
end
#