class Tarantool16::SchemaSpace::Index
Constants
- ITERS
Attributes
name[RW]
Public Class Methods
new(name, pos, type, parts, part_names)
click to toggle source
# File lib/tarantool16/schema.rb, line 240 def initialize(name, pos, type, parts, part_names) @name = name @pos = pos @type = type.downcase.to_sym @iters = ITERS[@type] or raise "Unknown index type #{type.inspect}" @parts = parts @part_names = part_names @part_positions = {} parts.each_with_index{|p, i| @part_positions[p] = i} part_names.each_with_index{|p, i| @part_positions[p.to_s] = i @part_positions[p.to_sym] = i } end
Public Instance Methods
can_iterator?(iter, flds_cnt)
click to toggle source
# File lib/tarantool16/schema.rb, line 255 def can_iterator?(iter, flds_cnt) @iters.include?(iter) && begin if iter == ITERATOR_ALL true elsif @type == :hash && flds_cnt == @parts.count true elsif flds_cnt == 1 true else false end end end
map_key(key)
click to toggle source
# File lib/tarantool16/schema.rb, line 269 def map_key(key) return key if key.is_a?(Array) || key.nil? res = [] positions = @part_positions key.each_key do |k| res[positions[k]] = key[k] end res end