class Tarantool16::Option

Attributes

error[RW]

Public Class Methods

error(err, message = nil) click to toggle source
# File lib/tarantool16/response.rb, line 21
def self.error(err, message = nil)
  if err.is_a? Class
    err = err.new message
  end
  new(err, nil)
end
new(err, data) click to toggle source
# File lib/tarantool16/response.rb, line 4
def initialize(err, data)
  @error = err
  @data = data
end
ok(data) click to toggle source
# File lib/tarantool16/response.rb, line 17
def self.ok(data)
  new(nil, data)
end

Public Instance Methods

inspect() click to toggle source
# File lib/tarantool16/response.rb, line 28
def inspect
  if ok?
    "<Option data=#{@data.inspect}>"
  else
    "<Option error=#{@error.inspect}>"
  end
end
ok?() click to toggle source
# File lib/tarantool16/response.rb, line 9
def ok?
  !@error
end
raise_if_error!() click to toggle source
# File lib/tarantool16/response.rb, line 13
def raise_if_error!
  raise @error if @error
end