Class: Syncify::Hint::BasicHint

Inherits:
Hint
  • Object
show all
Defined in:
lib/syncify/hint/basic_hint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_class: nil, association: nil, to_class: nil, allowed:) ⇒ BasicHint

Returns a new instance of BasicHint.



7
8
9
10
11
12
# File 'lib/syncify/hint/basic_hint.rb', line 7

def initialize(from_class: nil, association: nil, to_class: nil, allowed:)
  @from_class = from_class
  @association = association
  @to_class = to_class
  @allowed = allowed
end

Instance Attribute Details

#allowedObject Also known as: allowed?

Returns the value of attribute allowed.



4
5
6
# File 'lib/syncify/hint/basic_hint.rb', line 4

def allowed
  @allowed
end

#associationObject

Returns the value of attribute association.



4
5
6
# File 'lib/syncify/hint/basic_hint.rb', line 4

def association
  @association
end

#from_classObject

Returns the value of attribute from_class.



4
5
6
# File 'lib/syncify/hint/basic_hint.rb', line 4

def from_class
  @from_class
end

#to_classObject

Returns the value of attribute to_class.



4
5
6
# File 'lib/syncify/hint/basic_hint.rb', line 4

def to_class
  @to_class
end

Instance Method Details

#applicable?(candidate_association) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/syncify/hint/basic_hint.rb', line 14

def applicable?(candidate_association)
  evaluate_from(candidate_association) &&
    evaluate_association(candidate_association) &&
    evaluate_to_class(candidate_association)
end