Class: Droonga::Client
- Inherits:
-
Object
- Object
- Droonga::Client
- Defined in:
- lib/droonga/client.rb,
lib/droonga/client/error.rb,
lib/droonga/client/version.rb,
lib/droonga/client/rate-limiter.rb,
lib/droonga/client/connection/http.rb,
lib/droonga/client/connection/error.rb,
lib/droonga/client/connection/empty-request.rb,
lib/droonga/client/connection/droonga-protocol.rb,
lib/droonga/client/connection/droonga-protocol/coolio.rb,
lib/droonga/client/connection/droonga-protocol/thread.rb
Defined Under Namespace
Modules: Connection Classes: Error, RateLimiter
Constant Summary collapse
- VERSION =
"0.1.8"
Class Method Summary collapse
-
.open(options = {}) {|client| ... } ⇒ Object
Opens a new connection and yields a Client object to use the connection.
Instance Method Summary collapse
-
#close ⇒ void
Close the connection used by the client.
-
#initialize(options = {}) ⇒ Client
constructor
Creates a new Droonga Engine client.
- #request(message, options = {}, &block) ⇒ Object
- #send(message, options = {}, &block) ⇒ Object
- #subscribe(message, options = {}, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Creates a new Droonga Engine client.
62 63 64 |
# File 'lib/droonga/client.rb', line 62 def initialize(={}) @connection = create_connection() end |
Class Method Details
.open(options = {}) {|client| ... } ⇒ Object
Opens a new connection and yields a Droonga::Client object to use the connection. The client is closed after the given block is finished.
37 38 39 40 41 42 43 44 |
# File 'lib/droonga/client.rb', line 37 def open(={}) client = new() begin yield(client) ensure client.close end end |
Instance Method Details
#close ⇒ void
This method returns an undefined value.
Close the connection used by the client. You can't send any request anymore.
82 83 84 |
# File 'lib/droonga/client.rb', line 82 def close @connection.close end |
#request(message, options = {}, &block) ⇒ Object
70 71 72 |
# File 'lib/droonga/client.rb', line 70 def request(, ={}, &block) @connection.request(, , &block) end |
#send(message, options = {}, &block) ⇒ Object
66 67 68 |
# File 'lib/droonga/client.rb', line 66 def send(, ={}, &block) @connection.send(, , &block) end |
#subscribe(message, options = {}, &block) ⇒ Object
74 75 76 |
# File 'lib/droonga/client.rb', line 74 def subscribe(, ={}, &block) @connection.subscribe(, , &block) end |