Class: Grntest::Executors::StandardIOExecutor
- Inherits:
-
BaseExecutor
- Object
- BaseExecutor
- Grntest::Executors::StandardIOExecutor
- Defined in:
- lib/grntest/executors/standard-io-executor.rb
Instance Attribute Summary
Attributes inherited from BaseExecutor
Instance Method Summary collapse
- #create_sub_executor(context) ⇒ Object
- #ensure_groonga_ready ⇒ Object
-
#initialize(input, output, context) ⇒ StandardIOExecutor
constructor
A new instance of StandardIOExecutor.
- #send_command(command) ⇒ Object
Methods inherited from BaseExecutor
Constructor Details
#initialize(input, output, context) ⇒ StandardIOExecutor
Returns a new instance of StandardIOExecutor.
21 22 23 24 25 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 21 def initialize(input, output, context) super(context) @input = input @output = output end |
Instance Method Details
#create_sub_executor(context) ⇒ Object
50 51 52 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 50 def create_sub_executor(context) self.class.new(@input, @output, context) end |
#ensure_groonga_ready ⇒ Object
44 45 46 47 48 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 44 def ensure_groonga_ready @input.print("status\n") @input.flush @output.gets end |
#send_command(command) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 27 def send_command(command) command_line = command.original_source if !command.key?(:output_type) and @output_type command_line = command_line.sub(/$/, " --output_type #{@output_type}") end begin debug_input(command_line) @input.print(command_line) @input.print("\n") @input.flush rescue SystemCallError = "failed to write to groonga: <#{command_line}>: #{$!}" raise Error.new() end read_output(command) end |