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
9 10 11 12 |
# File 'lib/docker/messages_stack.rb', line 9 def initialize(size = -1) @messages = [] @size = size end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
4 5 6 |
# File 'lib/docker/messages_stack.rb', line 4 def @messages end |
Instance Method Details
#append(messages) ⇒ Object
Append messages to stack
17 18 19 20 21 22 23 24 |
# File 'lib/docker/messages_stack.rb', line 17 def append() return if @size == 0 ..each do |msg| @messages << msg @messages.shift if @size > -1 && @messages.size > @size end end |