Module: Fairy::SegJoin::Interface

Defined in:
lib/fairy/client/seg-join.rb

Instance Method Summary collapse

Instance Method Details

#seg_join(*others) ⇒ Object

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



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fairy/client/seg-join.rb', line 13

def seg_join(*others)
	block_source = nil
	if others.last.kind_of?(String)
	  block_source = others.pop
	elsif others.last.kind_of?(Hash) and others[-2].kind_of?(String)
	  block_source = others.delete_at(-2)
	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}

	pres = others.collect{|o|
	  p = PreJoinedFilter.new(@fairy, h)
	  p.input = o
	  p
	}

	block_source = BlockSource.new(block_source) 
	join = SegJoin.new(@fairy, h, pres, block_source)
	join.input = self
	join
end