mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/matrix.rb (Vector#each2, collect2): small refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2cfb894d2a
commit
800dda6c28
2 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Mar 3 15:54:20 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/matrix.rb (Vector#each2, collect2): small refactoring.
|
||||
|
||||
Wed Mar 3 16:14:24 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/matrix.rb (Vector#each): make Vector enumerable.
|
||||
|
|
|
@ -1170,7 +1170,7 @@ class Vector
|
|||
def collect2(v) # :yield: e1, e2
|
||||
Vector.Raise ErrDimensionMismatch if size != v.size
|
||||
return to_enum(:collect2, v) unless block_given?
|
||||
(0 ... size).collect do |i|
|
||||
size.times.collect do |i|
|
||||
yield @elements[i], v[i]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue