Class: Minecraft::HistoryQueue

Inherits:
Queue
  • Object
show all
Defined in:
lib/minecraft.rb

Direct Known Subclasses

MessageQueue

Instance Method Summary collapse

Constructor Details

#initializeHistoryQueue

Returns a new instance of HistoryQueue.



7
8
9
10
# File 'lib/minecraft.rb', line 7

def initialize
	@history = []
	super
end

Instance Method Details

#flushObject



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

#historyObject



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