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 57 def initialize(data) @data = data end
Public Instance Methods
%(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 125 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 113 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 124 def -(oth) to_i - oth end
/(oth)
click to toggle source
# File lib/tarantool/util.rb, line 126 def /(oth) to_i / oth end
<=>(oth)
click to toggle source
# File lib/tarantool/util.rb, line 102 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 90 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 131 def bytesize; @data.bytesize end
coerce(oth)
click to toggle source
# File lib/tarantool/util.rb, line 75 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 130 def empty?; @data.empty? end
hash()
click to toggle source
# File lib/tarantool/util.rb, line 134 def hash; @data.hash end
inspect()
click to toggle source
# File lib/tarantool/util.rb, line 86 def inspect "<#{self.class.name} data=#{@data.inspect}>" end
length()
click to toggle source
# File lib/tarantool/util.rb, line 133 def length; @data.length end
size()
click to toggle source
# File lib/tarantool/util.rb, line 132 def size; @data.size end
to_int()
click to toggle source
# File lib/tarantool/util.rb, line 61 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