Sha256: eb6d0e4565bccd2e60bfb223d4ff9a0cbdde09e11a4857b7af9e9806572cd375
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
# NB index instances are all internal to zermelo, not user-accessible require 'zermelo/records/key' module Zermelo module Associations class RangeIndex def initialize(parent_klass, name) @parent_klass = parent_klass @attribute_name = name @backend = parent_klass.send(:backend) parent_klass.send(:with_index_data, name.to_sym) do |data| @attribute_type = data.type end end def delete_id(id, value) @backend.delete(key, id) end def add_id(id, value) @backend.add(key, [@backend.safe_value(@attribute_type, value), id]) end def move_id(id, value_from, indexer_to, value_to) @backend.move(key, [@backend.safe_value(@attribute_type, value_from), id], indexer_to.key, [@backend.safe_value(@attribute_type, value_to), id]) end def key @indexer ||= Zermelo::Records::Key.new( :klass => @parent_klass, :name => "by_#{@attribute_name}", :type => :sorted_set, :object => :index ) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems