Module: Oxblood::Commands::Connection

Included in:
Oxblood::Commands
Defined in:
lib/oxblood/commands/connection.rb

Instance Method Summary collapse

Instance Method Details

#auth(password) ⇒ String, RError

Authenticate to the server

Parameters:

  • password (String)

Returns:

  • (String)

    ‘OK’

  • (RError)

    if wrong password was passed or server does not require password

See Also:



12
13
14
# File 'lib/oxblood/commands/connection.rb', line 12

def auth(password)
  run(:AUTH, password)
end

#echo(message) ⇒ String

Echo the given string

Parameters:

  • message (String)

Returns:

  • (String)

    given string

See Also:



22
23
24
# File 'lib/oxblood/commands/connection.rb', line 22

def echo(message)
  run(:ECHO, message)
end

#ping(message = nil) ⇒ String

Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk

Parameters:

  • message (String) (defaults to: nil)

    to return

Returns:

  • (String)

    message passed as argument

See Also:



33
34
35
# File 'lib/oxblood/commands/connection.rb', line 33

def ping(message = nil)
  message ? run(:PING, message) : run(:PING)
end

#quitString

Close the connection

Returns:

  • (String)

    ‘OK’

See Also:



52
53
54
55
56
# File 'lib/oxblood/commands/connection.rb', line 52

def quit
  run(:QUIT)
ensure
  connection.socket.close
end

#select(index) ⇒ String, RError

Change the selected database for the current connection

Parameters:

  • index (Integer)

    database to switch

Returns:

  • (String)

    ‘OK’

  • (RError)

    if wrong index was passed

See Also:



44
45
46
# File 'lib/oxblood/commands/connection.rb', line 44

def select(index)
  run(:SELECT, index)
end