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.
23 24 25 26 27 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 23 def initialize(input, output, context) super(context) @input = input @output = output end |
Instance Method Details
#create_sub_executor(context) ⇒ Object
52 53 54 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 52 def create_sub_executor(context) self.class.new(@input, @output, context) end |
#ensure_groonga_ready ⇒ Object
46 47 48 49 50 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 46 def ensure_groonga_ready @input.print("status\n") @input.flush @output.gets end |
#send_command(command) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/grntest/executors/standard-io-executor.rb', line 29 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 |