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-1.30.0 lib/docker/messages_stack.rb
docker-api-1.29.2 lib/docker/messages_stack.rb
docker-api-1.29.1 lib/docker/messages_stack.rb
docker-api-1.29.0 lib/docker/messages_stack.rb
docker-api-1.28.0 lib/docker/messages_stack.rb
docker-api-1.27.0 lib/docker/messages_stack.rb
docker-api-1.26.2 lib/docker/messages_stack.rb
docker-api-1.26.1 lib/docker/messages_stack.rb
docker-api-1.26.0 lib/docker/messages_stack.rb
docker-api-1.25.0 lib/docker/messages_stack.rb
docker-api-1.24.1 lib/docker/messages_stack.rb
docker-api-1.24.0 lib/docker/messages_stack.rb
docker-api-1.23.0 lib/docker/messages_stack.rb
docker-api-1.22.4 lib/docker/messages_stack.rb
docker-api-1.22.3 lib/docker/messages_stack.rb
docker-api-1.22.2 lib/docker/messages_stack.rb
docker-api-1.22.1 lib/docker/messages_stack.rb
docker-api-1.22.0 lib/docker/messages_stack.rb