Sha256: 14b845dcb64ae1154bedc7c64c624afd91b97a2b05ba0b6fac934052ceae82e5

Contents?: true

Size: 502 Bytes

Versions: 38

Compression:

Stored size: 502 Bytes

Contents

# This class represents a messages stack
class Docker::MessagesStack

  attr_accessor :messages

  # Initialize stack with optional size
  #
  # @param size [Integer]
  def initialize(size = -1)
    @messages = []
    @size = size
  end

  # Append messages to stack
  #
  # @param messages [Docker::Messages]
  def append(messages)
    return if @size == 0

    messages.all_messages.each do |msg|
      @messages << msg
      @messages.shift if @size > -1 && @messages.size > @size
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
docker-api-2.3.0 lib/docker/messages_stack.rb
docker-api-2.2.0 lib/docker/messages_stack.rb
docker-api-2.1.0 lib/docker/messages_stack.rb
docker-api-2.0.0 lib/docker/messages_stack.rb
docker-api-2.0.0.pre.1 lib/docker/messages_stack.rb
docker-api-1.34.2 lib/docker/messages_stack.rb
docker-api-1.34.1 lib/docker/messages_stack.rb
docker-api-1.34.0 lib/docker/messages_stack.rb
docker-api-1.33.6 lib/docker/messages_stack.rb
docker-api-1.33.5 lib/docker/messages_stack.rb
docker-api-1.33.4 lib/docker/messages_stack.rb
docker-api-1.33.3 lib/docker/messages_stack.rb
docker-api-1.33.2 lib/docker/messages_stack.rb
docker-api-1.33.1 lib/docker/messages_stack.rb
docker-api-1.33.0 lib/docker/messages_stack.rb
docker-api-1.32.1 lib/docker/messages_stack.rb
docker-api-1.32.0 lib/docker/messages_stack.rb
docker-api-1.31.0 lib/docker/messages_stack.rb
docker-api-1.30.2 lib/docker/messages_stack.rb
docker-api-1.30.1 lib/docker/messages_stack.rb