diff options
author | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 14:07:53 +0000 |
---|---|---|
committer | marcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-03 14:07:53 +0000 |
commit | b81e04571299a8e98d3931be9c10b9b63da375a8 (patch) | |
tree | e1f673ce9d3b06ab5c58b5dbd76ac3ea32ad71a8 /lib/matrix.rb | |
parent | 871e9d175e07e364802f00c945cec56ef42084df (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/matrix.rb')
-rw-r--r-- | lib/matrix.rb | 7 |
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 # |