# File lib/tarantool/base_record.rb, line 346 def ==(other) equal?(other) || (other.class == self.class && id == other.id) end
# File lib/tarantool/base_record.rb, line 368 def _raise_doesnt_exists(action = "update") raise TupleDoesntExists.new(0x3102, "Record which you wish to #{action}, doesn't exists") end
# File lib/tarantool/base_record.rb, line 309 def _tail @attributes[:_tail] end
# File lib/tarantool/base_record.rb, line 313 def _tail=(v) @attributes[:_tail] = v end
# File lib/tarantool/base_record.rb, line 332 def auto_space self.class.space end
# File lib/tarantool/base_record.rb, line 322 def id (primary = self.class.primary_index).size == 1 ? @attributes[primary[0]] : @attributes.values_at(*primary) end
# File lib/tarantool/base_record.rb, line 364 def increment(field, by = 1) update([[field.to_sym, :+, by]]) end
# File lib/tarantool/base_record.rb, line 293 def new_record! @__new_record = true self end
# File lib/tarantool/base_record.rb, line 298 def old_record! @__new_record = false self end
# File lib/tarantool/base_record.rb, line 336 def reload if hash = space.by_pk(id) @__new_record = false @attributes = hash self else _raise_doesnt_exists("reload") end end
# File lib/tarantool/base_record.rb, line 303 def set_attributes(attributes) attributes.each do |k, v| send("#{k}=", v) end end
# File lib/tarantool/base_record.rb, line 328 def space self.class.space end
update record in db first, reload it then
record.update({:state => 'sleep', :sleep_count => [:+, 1]}) record.update([[:state, 'sleep'], [:sleep_count, :+, 1]])
# File lib/tarantool/base_record.rb, line 354 def update(ops) raise UpdateNewRecord, "Could not call update on new record" if @__new_record unless new_attrs = space.update(id, ops, return_tuple: true) _raise_doesnt_exists end @attributes = new_attrs self end
Generated with the Darkfish Rdoc Generator 2.