Class: Pakyow::Data::Sources::Relational::Association Private
- Inherits:
-
Object
- Object
- Pakyow::Data::Sources::Relational::Association
- 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.
Direct Known Subclasses
Pakyow::Data::Sources::Relational::Associations::BelongsTo, Pakyow::Data::Sources::Relational::Associations::HasMany, Pakyow::Data::Sources::Relational::Associations::HasOne
Instance Attribute Summary collapse
- #associated_source ⇒ Object private
- #associated_source_name ⇒ Object readonly private
- #name ⇒ Object readonly private
- #query ⇒ Object readonly private
- #source ⇒ Object readonly private
Instance Method Summary collapse
- #dependent_source_names ⇒ Object private
-
#initialize(name:, query:, source:, associated_source_name:) ⇒ Association
constructor
private
A new instance of Association.
- #internal! ⇒ Object private
- #internal? ⇒ Boolean private
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_source ⇒ 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.
11 12 13 |
# File 'lib/pakyow/data/sources/relational/association.rb', line 11 def associated_source @associated_source end |
#associated_source_name ⇒ Object (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 |
#name ⇒ Object (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 |
#query ⇒ Object (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 |
#source ⇒ Object (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_names ⇒ 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.
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.
35 36 37 |
# File 'lib/pakyow/data/sources/relational/association.rb', line 35 def internal? @internal == true end |