summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-29 11:27:03 +0000
committerkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-29 11:27:03 +0000
commitcd492563f8db2a6d81a498d21cd6d46853c81496 (patch)
treeadb8a168631b3a0229e760a4369fe36c470a2173
parent33d16472528f36d93f82310344ac801c3a90eb3e (diff)
* lib/matrix.rb(Vector#each2, Vector#collect2): add type check for
Integer[Bug #2495]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/matrix.rb2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1403a07..4a750e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 29 20:23:05 2010 Keiju Ishitsuka <keiju@ruby-lang.org>
+
+ * lib/matrix.rb(Vector#each2, Vector#collect2): add type check for
+ Integer[Bug #2495].
+
Mon Mar 29 19:45:09 2010 Tanaka Akira <akr@fsij.org>
* time.c: wide value condition changed.
diff --git a/lib/matrix.rb b/lib/matrix.rb
index b3a7e79..7afc7d5 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -1154,6 +1154,7 @@ class Vector
# Iterate over the elements of this vector and +v+ in conjunction.
#
def each2(v) # :yield: e1, e2
+ raise TypeError, "Integer is not like Vector" if v.kind_of?(Integer)
Vector.Raise ErrDimensionMismatch if size != v.size
return to_enum(:each2, v) unless block_given?
size.times do |i|
@@ -1167,6 +1168,7 @@ class Vector
# in conjunction.
#
def collect2(v) # :yield: e1, e2
+ raise TypeError, "Integer is not like Vector" if v.kind_of?(Integer)
Vector.Raise ErrDimensionMismatch if size != v.size
return to_enum(:collect2, v) unless block_given?
size.times.collect do |i|