Class: MessageCollectorProcessed

Inherits:
MessageCollector show all
Defined in:
bin/minecraftctlserver

Direct Known Subclasses

TextCollector

Instance Method Summary collapse

Methods inherited from MessageCollector

#each, for

Constructor Details

#initialize(&operations) ⇒ MessageCollectorProcessed

Returns a new instance of MessageCollectorProcessed.



16
17
18
19
# File 'bin/minecraftctlserver', line 16

def initialize(&operations)
	super(&operations)
	@processors = []
end

Instance Method Details

#collect(msg) ⇒ Object



26
27
28
29
30
31
# File 'bin/minecraftctlserver', line 26

def collect(msg)
	@processors.each do |processor|
		msg = processor.call(msg)
	end
	@collector.call(msg) if msg
end

#process(&block) ⇒ Object



21
22
23
24
# File 'bin/minecraftctlserver', line 21

def process(&block)
	@processors << block
	self
end