Class: FileProcessingJob::Connection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- FileProcessingJob::Connection
show all
- Defined in:
- lib/fpj/connection.rb
Constant Summary
collapse
- TOKEN =
"_-|fpj|-_"
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ Connection
Returns a new instance of Connection.
5
6
7
8
9
|
# File 'lib/fpj/connection.rb', line 5
def initialize(*args)
super
@recv_buffer = BufferedTokenizer.new(TOKEN)
end
|
Instance Method Details
#receive_data(data) ⇒ Object
20
21
22
23
24
|
# File 'lib/fpj/connection.rb', line 20
def receive_data(data)
@recv_buffer.(data).each do |msg|
receive_task(msg)
end
end
|
#receive_request ⇒ Object
30
31
32
|
# File 'lib/fpj/connection.rb', line 30
def receive_request
raise "receive_task not overridden by #{self.class.name}"
end
|
#send_message(data) ⇒ Object
26
27
28
|
# File 'lib/fpj/connection.rb', line 26
def send_message(data)
send_data "#{data}#{TOKEN}"
end
|