Module: Fairy::DirectProduct::Interface

Defined in:
lib/fairy/client/direct-product.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



33
34
35
# File 'lib/fairy/client/direct-product.rb', line 33

def *(other)
	direct_product(other, %{|e| e})
end

#direct_product(*others) ⇒ Object Also known as: product

jpb.direct_product(opts,…,filter,…,block_source, opts,…)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fairy/client/direct-product.rb', line 13

def direct_product(*others)
	block_source = nil
	if others.last.kind_of?(String)
	  block_source = others.pop
	end
	others, opts = others.partition{|e| e.kind_of?(Filter)}
	if opts.last.kind_of?(Hash)
	  h = opts.pop
	else
	  h = {}
	end
	opts.each{|e| h[e] = true}

	block_source = BlockSource.new(block_source) 
	dp = DirectProduct.new(@fairy, h, others, block_source)
	dp.input = self
	dp
end