class Tarantool16::Connection::Option

Attributes

sync[RW]

Public Class Methods

error(sync, err, message = nil) click to toggle source
# File lib/tarantool16/connection/response.rb, line 30
def self.error(sync, err, message = nil)
  if err.is_a? Class
    err = err.new message
  end
  new(sync, err, nil)
end
new(sync, err, data) click to toggle source
# File lib/tarantool16/connection/response.rb, line 8
def initialize(sync, err, data)
  @sync = sync
  @error = err
  @data = data
end
ok(sync, code, data) click to toggle source
# File lib/tarantool16/connection/response.rb, line 22
def self.ok(sync, code, data)
  if code == 0
    new(sync, nil, data)
  else
    new(sync, ::Tarantool16::DBError.with_code_message(code&(REQUEST_TYPE_ERROR-1), data), nil)
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/tarantool16/connection/response.rb, line 37
def inspect
  s = @sync ? " sync=#{sync}" : ""
  if ok?
    "<Option#{s} data=#{@data.inspect}>"
  else
    "<Option#{s} error=#{@error.inspect}>"
  end
end
ok?() click to toggle source
# File lib/tarantool16/connection/response.rb, line 14
def ok?
  !@error
end
raise_if_error!() click to toggle source
# File lib/tarantool16/connection/response.rb, line 18
def raise_if_error!
  raise @error if @error
end