class Groonga::Client::Protocol::HTTP
Public Class Methods
new(url, options)
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 34 def initialize(url, options) @url = url @options = default_options.merge(options) @backend = create_backend end
Public Instance Methods
close(&block)
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 48 def close(&block) @backend.close(&block) end
connected?()
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 44 def connected? @backend.connected? end
send(command, &block)
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 40 def send(command, &block) @backend.send(command, &block) end
Private Instance Methods
create_backend()
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 59 def create_backend backend = @options[:backend] || :thread begin require "groonga/client/protocol/http/#{backend}" rescue LoadError raise UnknownBackendError.new(backend, $!.message) end backend_name = backend.to_s.capitalize backend_class = self.class.const_get(backend_name) backend_class.new(@url, @options) end
default_options()
click to toggle source
# File lib/groonga/client/protocol/http.rb, line 53 def default_options { :user_agent => "groonga-client/#{VERSION}", } end