class Tarantool::Util::AutoType

Attributes

data[R]
to_s[R]
to_str[R]

Public Class Methods

new(data) click to toggle source
# File lib/tarantool/util.rb, line 60
def initialize(data)
  @data = data
end

Public Instance Methods

%(oth) click to toggle source
# File lib/tarantool/util.rb, line 130
def %(oth) to_i % oth end
*(oth) click to toggle source
# File lib/tarantool/util.rb, line 128
def *(oth) to_i * oth end
**(oth) click to toggle source
# File lib/tarantool/util.rb, line 131
def **(oth) to_i ** oth end
+(oth) click to toggle source
# File lib/tarantool/util.rb, line 116
def +(oth)
  case oth
  when Numeric
    to_i + oth
  when String
    @data + oth
  when AutoType
    @data + oth.data
  end
end
-(oth) click to toggle source
# File lib/tarantool/util.rb, line 127
def -(oth) to_i - oth end
/(oth) click to toggle source
# File lib/tarantool/util.rb, line 129
def /(oth) to_i / oth end
<=>(oth) click to toggle source
# File lib/tarantool/util.rb, line 105
def <=>(oth)
  case oth
  when Numeric
    to_i <=> oth
  when String
    @data <=> oth
  when AutoType
    @data <=> oth.data
  end
end
==(oth) click to toggle source
# File lib/tarantool/util.rb, line 93
def ==(oth)
  case oth
  when Numeric
    to_i == oth
  when String
    @data == oth
  when AutoType
    @data == oth.data
  end
end
Also aliased as: eql?
bytesize() click to toggle source
# File lib/tarantool/util.rb, line 134
def bytesize; @data.bytesize  end
coerce(oth) click to toggle source
# File lib/tarantool/util.rb, line 78
def coerce(oth)
  case oth
  when Numeric
    [oth, to_i]
  when String
    [oth, @data]
  end
end
empty?() click to toggle source
# File lib/tarantool/util.rb, line 133
def empty?;   @data.empty?    end
eql?(oth)
Alias for: ==
hash() click to toggle source
# File lib/tarantool/util.rb, line 137
def hash;     @data.hash      end
inspect() click to toggle source
# File lib/tarantool/util.rb, line 89
def inspect
  "<#{self.class.name} data=#{@data.inspect}>"
end
length() click to toggle source
# File lib/tarantool/util.rb, line 136
def length;   @data.length    end
size() click to toggle source
# File lib/tarantool/util.rb, line 135
def size;     @data.size      end
to_i()
Alias for: to_int
to_int() click to toggle source
# File lib/tarantool/util.rb, line 64
def to_int
  case @data.bytesize
  when 8
    ::BinUtils.get_int64_le(@data)
  when 4
    ::BinUtils.get_int32_le(@data)
  when 2
    ::BinUtils.get_int16_le(@data)
  else
    raise ValueError, "Bad field size #{field_size} for integer field ##{i}"
  end
end
Also aliased as: to_i