Class: Wukong::Local::StdioDriver
Overview
A class for driving processors over the STDIN/STDOUT protocol.
Instance Attribute Summary
#dataflow, #settings
Class Method Summary
collapse
Instance Method Summary
collapse
included
#process, #setup, #stop
included, #initialize
#add_serialization, #build_serializer, #construct_dataflow, #driver, #finalize_and_stop_dataflow, #finalize_dataflow, #lookup, #lookup_and_build, #setup_dataflow
Class Method Details
.start(label, settings = {}) ⇒ Object
11
12
13
|
# File 'lib/wukong/local/stdio_driver.rb', line 11
def self.start(label, settings = {})
EM.attach($stdin, self, label, settings)
end
|
Instance Method Details
#post_init ⇒ Object
15
16
17
18
|
# File 'lib/wukong/local/stdio_driver.rb', line 15
def post_init
self.class.add_signal_traps
setup_dataflow
end
|
#receive_line(line) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/wukong/local/stdio_driver.rb', line 20
def receive_line line
driver.send_through_dataflow(line)
rescue => e
error = Wukong::Error.new(e)
EM.stop
log.error(error.message)
end
|
#unbind ⇒ Object
38
39
40
41
|
# File 'lib/wukong/local/stdio_driver.rb', line 38
def unbind
finalize_and_stop_dataflow
EM.stop
end
|