Class: DRbQS::Worker::Serialize::Unpacker

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/worker/serialize.rb

Instance Method Summary collapse

Constructor Details

#initializeUnpacker

Returns a new instance of Unpacker.



7
8
9
10
# File 'lib/drbqs/worker/serialize.rb', line 7

def initialize
  @chunk = ''
  @next_size = nil
end

Instance Method Details

#each(&block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/drbqs/worker/serialize.rb', line 37

def each(&block)
  if block_given?
    while ary = next_object
      sym, obj = ary
      yield(obj)
    end
  else
    to_enum(:each)
  end
end

#feed(data) ⇒ Object



12
13
14
# File 'lib/drbqs/worker/serialize.rb', line 12

def feed(data)
  @chunk << data
end

#feed_each(data, &block) ⇒ Object



48
49
50
51
# File 'lib/drbqs/worker/serialize.rb', line 48

def feed_each(data, &block)
  feed(data)
  each(&block)
end