Module: PipelineToolkit::Cucumber::PipelineIO
- Included in:
- Machine
- Defined in:
- lib/pipeline_toolkit/cucumber/pipeline_io.rb
Overview
Provides IO methods for reading and writting pipeline messages to an IOProcess. NB: It is assumed that the module is being included in a IOProcess or subclass of.
Instance Attribute Summary collapse
-
#all_messages ⇒ Object
readonly
Returns the value of attribute all_messages.
Instance Method Summary collapse
-
#get_messages(number, timeout = 5) ⇒ Object
Gets output from process, and decodes it into a pipeline message.
- #input_messages(messages, simulate_acks = false) ⇒ Object
Instance Attribute Details
#all_messages ⇒ Object (readonly)
Returns the value of attribute all_messages.
11 12 13 |
# File 'lib/pipeline_toolkit/cucumber/pipeline_io.rb', line 11 def @all_messages end |
Instance Method Details
#get_messages(number, timeout = 5) ⇒ Object
Gets output from process, and decodes it into a pipeline message
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pipeline_toolkit/cucumber/pipeline_io.rb', line 14 def (number, timeout = 5) output_msgs = [] get_lines(@process.stdout, number, timeout) do |line| msg = MessageCoder.decode(line) output_msgs << msg end @all_messages ||= [] @all_messages.concat(output_msgs) output_msgs end |
#input_messages(messages, simulate_acks = false) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pipeline_toolkit/cucumber/pipeline_io.rb', line 27 def (, simulate_acks = false) .each do || simulate_ack_id() if simulate_acks @process.stdin.puts(MessageCoder.encode()) @process.stdin.flush end end |