Class: Groonga::Client::Protocol::File
- Inherits:
-
Object
- Object
- Groonga::Client::Protocol::File
- Defined in:
- lib/groonga/client/protocol/file.rb
Instance Method Summary collapse
- #close(&block) ⇒ Object
- #connected? ⇒ Boolean
-
#initialize(url, options) ⇒ File
constructor
A new instance of File.
- #send(command, &block) ⇒ Object
Constructor Details
#initialize(url, options) ⇒ File
Returns a new instance of File.
24 25 26 27 |
# File 'lib/groonga/client/protocol/file.rb', line 24 def initialize(url, ) @url = url @options = end |
Instance Method Details
#close(&block) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/groonga/client/protocol/file.rb', line 54 def close(&block) if block_given? yield EmptyRequest.new else false end end |
#connected? ⇒ Boolean
50 51 52 |
# File 'lib/groonga/client/protocol/file.rb', line 50 def connected? false end |
#send(command, &block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/groonga/client/protocol/file.rb', line 29 def send(command, &block) open_pipes do |input, output, error| = { :in => input[0], :out => output[1], :err => error[1], } pid = spawn("groonga", @url.path, ) 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 |