summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-19 02:07:00 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-19 02:07:00 +0000
commit959022a6762e8266274766332bafdf948bc84ab3 (patch)
treed4393cfc3b3b595e182518afef545346e8483e74 /lib
parent35a8eb05a6f670c0eba85be7a3353b761e103f14 (diff)
downloadruby-959022a6762e8266274766332bafdf948bc84ab3.tar.gz
ruby-959022a6762e8266274766332bafdf948bc84ab3.tar.xz
ruby-959022a6762e8266274766332bafdf948bc84ab3.zip
* lib/matrix.rb (each2,collect2,map2): Fix enumerator [ruby-core:27225]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 3c75751e3..e0095e929 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -1147,7 +1147,7 @@ class Vector
#
def each2(v) # :yield: e1, e2
Vector.Raise ErrDimensionMismatch if size != v.size
- return to_enum(:each2) unless block_given?
+ return to_enum(:each2, v) unless block_given?
size.times do |i|
yield @elements[i], v[i]
end
@@ -1159,7 +1159,7 @@ class Vector
#
def collect2(v) # :yield: e1, e2
Vector.Raise ErrDimensionMismatch if size != v.size
- return to_enum(:collect2) unless block_given?
+ return to_enum(:collect2, v) unless block_given?
(0 ... size).collect do |i|
yield @elements[i], v[i]
end
@@ -1290,7 +1290,7 @@ class Vector
# Like Vector#collect2, but returns a Vector instead of an Array.
#
def map2(v, &block) # :yield: e1, e2
- return to_enum(:map2) unless block_given?
+ return to_enum(:map2, v) unless block_given?
els = collect2(v, &block)
Vector.elements(els, false)
end