Class: Pakyow::Data::Sources::Relational::Association Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pakyow/data/sources/relational/association.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(name:, query:, source:, associated_source_name:) ⇒ Association

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 Association.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pakyow/data/sources/relational/association.rb', line 16

def initialize(name:, query:, source:, associated_source_name:)
  @name = case result_type
  when :one
    Support.inflector.singularize(name).to_sym
  when :many
    Support.inflector.pluralize(name).to_sym
  end

  @query, @source, @associated_source_name = query, source, Support.inflector.pluralize(associated_source_name).to_sym

  @internal = false
end

Instance Attribute Details

#associated_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.



11
12
13
# File 'lib/pakyow/data/sources/relational/association.rb', line 11

def associated_source
  @associated_source
end

#associated_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.



11
12
13
# File 'lib/pakyow/data/sources/relational/association.rb', line 11

def associated_source_name
  @associated_source_name
end

#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.



11
12
13
# File 'lib/pakyow/data/sources/relational/association.rb', line 11

def name
  @name
end

#queryObject (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.



11
12
13
# File 'lib/pakyow/data/sources/relational/association.rb', line 11

def query
  @query
end

#sourceObject (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.



11
12
13
# File 'lib/pakyow/data/sources/relational/association.rb', line 11

def source
  @source
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.



30
31
32
# File 'lib/pakyow/data/sources/relational/association.rb', line 30

def dependent_source_names
  [@associated_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.



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

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)


35
36
37
# File 'lib/pakyow/data/sources/relational/association.rb', line 35

def internal?
  @internal == true
end