Method: Rubcask::Server::Client.with_client

Defined in:
lib/rubcask/server/client.rb

.with_client(host, port) {|the| ... } ⇒ Object

yields a new client to the block closes the client after the block is terminated

Parameters:

  • host (String)

    hostname of the server

  • port (String)

    port of the server

Yield Parameters:

  • the (Client)

    running client



23
24
25
26
27
28
29
30
# File 'lib/rubcask/server/client.rb', line 23

def self.with_client(host, port)
  client = new(host, port)
  begin
    yield client
  ensure
    client.close
  end
end