class Db::Sync::Model
Public Class Methods
include_id?()
click to toggle source
# File lib/db/sync/model.rb, line 16 def self.include_id? attribute_names.include?('id') end
ordered_attributes()
click to toggle source
# File lib/db/sync/model.rb, line 28 def self.ordered_attributes pkey + (attribute_names - pkey).sort end
pkey()
click to toggle source
# File lib/db/sync/model.rb, line 20 def self.pkey if include_id? ['id'] else attribute_names.sort end end
records()
click to toggle source
# File lib/db/sync/model.rb, line 32 def self.records attributes_order = ordered_attributes order(pkey).map do |record| res = {} attributes_order.each do |key| res[key] = record[key] end res end end
Public Instance Methods
compare_unique_data(other)
click to toggle source
# File lib/db/sync/model.rb, line 10 def compare_unique_data(other) self.class.pkey.each do |key| attributes[key] <=> other[key] end end
unique_data()
click to toggle source
# File lib/db/sync/model.rb, line 6 def unique_data attributes.slice(*self.class.pkey) end