APIdock / Ruby
/
method

collect2

ruby latest stable - Class: Vector
collect2(v)
public

Collects (as in Enumerable#collect) over the elements of this vector and v in conjunction.

# File lib/matrix.rb, line 1802
 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?
 Array.new(size) do |i|
 yield @elements[i], v[i]
 end
 end

AltStyle によって変換されたページ (->オリジナル) /