Class: PgGraph::Data::AssociationField
- Inherits:
-
Field
- Object
- Node
- DatabaseObject
- Field
- PgGraph::Data::AssociationField
- Defined in:
- lib/pg_graph/data/data.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
The association object.
Attributes inherited from Field
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(record, name, association) ⇒ AssociationField
constructor
A new instance of AssociationField.
-
#object ⇒ Object
Return the value of the association.
-
#table ⇒ Object
The table of the associated record(s).
Methods inherited from Field
#database, #guid, #name, #to_h, #uid
Methods inherited from DatabaseObject
#<=>, #database, #dot, #guid, #name, #uid
Methods inherited from Node
#data, #inspect, #to_h, #to_yaml, #value, #value_type
Constructor Details
#initialize(record, name, association) ⇒ AssociationField
Returns a new instance of AssociationField.
510 511 512 513 514 |
# File 'lib/pg_graph/data/data.rb', line 510 def initialize(record, name, association) constrain association, Association super(record, name, dimension: association.dimension) @association = association end |
Instance Attribute Details
#association ⇒ Object (readonly)
The association object
508 509 510 |
# File 'lib/pg_graph/data/data.rb', line 508 def association @association end |
Instance Method Details
#object ⇒ Object
Return the value of the association. This is either a Record, TableValue, or MmTableValue depending on the dimension of the association
518 519 520 |
# File 'lib/pg_graph/data/data.rb', line 518 def object() @object ||= Dimension.value_class(dimension).new(table, association.get_records(record)) end |
#table ⇒ Object
The table of the associated record(s)
505 |
# File 'lib/pg_graph/data/data.rb', line 505 def table() association.that_table end |