lib/tracksperanto/accumulator.rb in tracksperanto-2.0.1 vs lib/tracksperanto/accumulator.rb in tracksperanto-2.0.2
- old
+ new
@@ -2,33 +2,33 @@
# of objects on disk and then retreive them one by one. Make sure to call #close! when done with it to
# discard the stored blob. This object is intended to be used as a Tracksperanto::Import::Base#receiver
class Tracksperanto::Accumulator < DelegateClass(IO)
# Stores the number of objects stored so far
- attr_reader :numt
+ attr_reader :num_objects
def initialize
__setobj__(Tracksperanto::BufferIO.new)
- @numt = 0
+ @num_objects = 0
end
# Store an object
def push(object_to_store)
- @numt += 1
+ @num_objects += 1
d = Marshal.dump(object_to_store)
bytelen = d.size
write(bytelen)
write("\t")
write(d)
write("\n")
end
- # Retreive each stored object in succession
+ # Retreive each stored object in succession and unlink the buffer
def each_object_with_index
rewind
- @numt.times { |i| yield(recover_object, i - 1) }
+ @num_objects.times { |i| yield(recover_object, i - 1) }
end
private
def recover_object
\ No newline at end of file