class Syncify::Association::StandardAssociation

Attributes

destination[RW]
from_class[RW]
name[RW]
to_class[RW]
traversed[RW]

Public Class Methods

new(from_class:, association:, destination:) click to toggle source
# File lib/syncify/association/standard_association.rb, line 6
def initialize(from_class:, association:, destination:)
  @from_class = from_class
  @to_class = association.klass
  @name = association.name
  @destination = destination
  @traversed = false
end

Public Instance Methods

create_destination(name) click to toggle source
# File lib/syncify/association/standard_association.rb, line 30
def create_destination(name)
  destination[name] = {}
end
eql?(other_association) click to toggle source
# File lib/syncify/association/standard_association.rb, line 38
def eql?(other_association)
  self.from_class == other_association.from_class &&
    self.to_class == other_association.to_class &&
    self.name == other_association.name
end
hash() click to toggle source
# File lib/syncify/association/standard_association.rb, line 34
def hash
  "#{self.from_class.to_s}#{self.to_class.to_s}#{self.name}".hash
end
inverse_of?(association) click to toggle source
# File lib/syncify/association/standard_association.rb, line 22
def inverse_of?(association)
  if association.polymorphic?
    association.to_classes.include?(from_class) && association.from_class == to_class
  else
    association.to_class == from_class && association.from_class == to_class
  end
end
polymorphic?() click to toggle source
# File lib/syncify/association/standard_association.rb, line 14
def polymorphic?
  false
end
traversed?() click to toggle source
# File lib/syncify/association/standard_association.rb, line 18
def traversed?
  traversed
end