class Groonga::Client::Protocol::File
Public Class Methods
new(url, options)
click to toggle source
# File lib/groonga/client/protocol/file.rb, line 24 def initialize(url, options) @url = url @options = options end
Public Instance Methods
close() { || ... }
click to toggle source
# File lib/groonga/client/protocol/file.rb, line 54 def close(&block) if block_given? yield EmptyRequest.new else false end end
connected?()
click to toggle source
# File lib/groonga/client/protocol/file.rb, line 50 def connected? false end
send(command) { |response| ... }
click to toggle source
# File lib/groonga/client/protocol/file.rb, line 29 def send(command, &block) open_pipes do |input, output, error| options = { :in => input[0], :out => output[1], :err => error[1], } pid = spawn("groonga", @url.path, options) input[0].close output[1].close error[1].close input[1].puts(command.to_command_format) input[1].close response = output[0].read Process.waitpid(pid) yield(response) EmptyRequest.new end end
Private Instance Methods
open_pipes() { |input, output, error| ... }
click to toggle source
# File lib/groonga/client/protocol/file.rb, line 64 def open_pipes IO.pipe do |input| IO.pipe do |output| IO.pipe do |error| yield(input, output, error) end end end end