Method: Klay::Client.create

Defined in:
lib/klay/client.rb

.create(host) ⇒ Klay::Client::Ipc, Klay::Client::Http

Creates a new RPC-Client, either by providing an HTTP/S host or an IPC path.

Parameters:

  • host (String)

    either an HTTP/S host or an IPC path.

Returns:

Raises:

  • (ArgumentError)

    in case it cannot determine the client type.



47
48
49
50
51
# File 'lib/klay/client.rb', line 47

def self.create(host)
  return Client::Ipc.new host if host.end_with? ".ipc"
  return Client::Http.new host if host.start_with? "http"
  raise ArgumentError, "Unable to detect client type!"
end