Class: Docker::MessagesStack
- Inherits:
-
Object
- Object
- Docker::MessagesStack
- Defined in:
- lib/docker/messages_stack.rb
Overview
This class represents a messages stack
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
-
#append(messages) ⇒ Object
Append messages to stack.
-
#initialize(size = -1)) ⇒ MessagesStack
constructor
Initialize stack with optional size.
Constructor Details
#initialize(size = -1)) ⇒ MessagesStack
Initialize stack with optional size
11 12 13 14 |
# File 'lib/docker/messages_stack.rb', line 11 def initialize(size = -1) @messages = [] @size = size end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
6 7 8 |
# File 'lib/docker/messages_stack.rb', line 6 def @messages end |
Instance Method Details
#append(messages) ⇒ Object
Append messages to stack
19 20 21 22 23 24 25 26 |
# File 'lib/docker/messages_stack.rb', line 19 def append() return if @size == 0 ..each do |msg| @messages << msg @messages.shift if @size > -1 && @messages.size > @size end end |