Module: Array::Cross

Defined in:
lib/vex/base/array/cross.rb

Defined Under Namespace

Modules: Etest

Instance Method Summary collapse

Instance Method Details

#cross(other, &block) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/vex/base/array/cross.rb', line 2

def cross(other, &block)
  if !block_given?
    r = []
    cross(other) do |mine, others|
      r << [ mine, others ]
    end
    return r 
  else    
    each do |obj|
      other.each do |oo| yield obj, oo end
    end
  end
end