Class: Minecraft::HistoryQueue
- Inherits:
-
Queue
- Object
- Queue
- Minecraft::HistoryQueue
- Defined in:
- lib/minecraft.rb
Direct Known Subclasses
Instance Method Summary collapse
- #flush ⇒ Object
- #history ⇒ Object
-
#initialize ⇒ HistoryQueue
constructor
A new instance of HistoryQueue.
- #pop(blocking = false) ⇒ Object
Constructor Details
#initialize ⇒ HistoryQueue
Returns a new instance of HistoryQueue.
7 8 9 10 |
# File 'lib/minecraft.rb', line 7 def initialize @history = [] super end |
Instance Method Details
#flush ⇒ Object
12 13 14 15 16 17 |
# File 'lib/minecraft.rb', line 12 def flush until empty? msg = pop(true) yield msg if block_given? end end |
#history ⇒ Object
19 20 21 22 |
# File 'lib/minecraft.rb', line 19 def history flush @history end |
#pop(blocking = false) ⇒ Object
24 25 26 27 28 |
# File 'lib/minecraft.rb', line 24 def pop(blocking = false) msg = super(blocking) @history << msg msg end |