Class: Pakyow::Data::Sources::Relational::Associations::Through Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pakyow/data/sources/relational/associations/through.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(association, joining_source_name:) ⇒ Through

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Through.



26
27
28
29
30
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 26

def initialize(association, joining_source_name:)
  @association, @joining_source_name = association, Support.inflector.pluralize(joining_source_name).to_sym

  @internal = false
end

Instance Attribute Details

#joining_sourceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 16

def joining_source
  @joining_source
end

#joining_source_nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 16

def joining_source_name
  @joining_source_name
end

Instance Method Details

#dependent_source_namesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 36

def dependent_source_names
  [@association.associated_source_name, @joining_source_name]
end

#internal!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



60
61
62
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 60

def internal!
  @internal = true
end

#internal?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


56
57
58
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 56

def internal?
  @internal == true
end

#left_foreign_key_fieldObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 44

def left_foreign_key_field
  :"#{left_name}_#{@association.associated_source.primary_key_field}"
end

#left_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 40

def left_name
  Support.inflector.singularize(@association.name).to_sym
end

#right_foreign_key_fieldObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 52

def right_foreign_key_field
  :"#{right_name}_#{@association.source.primary_key_field}"
end

#right_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 48

def right_name
  Support.inflector.singularize(@association.associated_name).to_sym
end

#typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/pakyow/data/sources/relational/associations/through.rb', line 32

def type
  :through
end