Class: EventMachine::Zipper::Base

Inherits:
Object
  • Object
show all
Includes:
Deferrable
Defined in:
lib/em-zipper/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files, zos) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
# File 'lib/em-zipper/base.rb', line 10

def initialize(files, zos)
  @files  = files
  @zos    = zos
  @fqueue = EM::Queue.new
  @count  = 0
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



8
9
10
# File 'lib/em-zipper/base.rb', line 8

def files
  @files
end

#fqueueObject (readonly)

Returns the value of attribute fqueue.



8
9
10
# File 'lib/em-zipper/base.rb', line 8

def fqueue
  @fqueue
end

#zosObject (readonly)

Returns the value of attribute zos.



8
9
10
# File 'lib/em-zipper/base.rb', line 8

def zos
  @zos
end

Instance Method Details

#zip!Object



17
18
19
20
21
22
23
24
# File 'lib/em-zipper/base.rb', line 17

def zip!
  files.each do |file_path|
    EM.next_tick { chunk_data(file_path) }
  end
  fqueue.pop(&write_entry) # begin queue, first file to chunk will be issued this call

  self # ...new(..., ...).zip!
end