Module: Fairy::SegZip::Interface

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

Instance Method Summary collapse

Instance Method Details

#seg_zip(*others) ⇒ Object

jpb.seg_zip(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
# File 'lib/fairy/client/seg-zip.rb', line 13

def seg_zip(*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}

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

  block_source = BlockSource.new(block_source) 
  zip = SegZip.new(@fairy, h, pres, block_source)
  zip.input = self
  zip
end