Sha256: 5d035894d99b60bca7a49ff0a611a348b34d2707668c8607612f17f3b7d33800
Contents?: true
Size: 627 Bytes
Versions: 51
Compression:
Stored size: 627 Bytes
Contents
module Kafka class PendingMessageQueue attr_reader :size, :bytesize def initialize clear end def write(message) @messages << message @size += 1 @bytesize += message.bytesize end def empty? @messages.empty? end def clear @messages = [] @size = 0 @bytesize = 0 end def replace(messages) clear messages.each {|message| write(message) } end # Yields each message in the queue. # # @yieldparam [PendingMessage] message # @return [nil] def each(&block) @messages.each(&block) end end end
Version data entries
51 entries across 51 versions & 1 rubygems