Class: Preserves::Mapper::Relation
- Inherits:
-
Object
- Object
- Preserves::Mapper::Relation
- Defined in:
- lib/preserves/mapper/relation.rb
Instance Attribute Summary collapse
-
#mapping ⇒ Object
readonly
Returns the value of attribute mapping.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#relation_name ⇒ Object
readonly
Returns the value of attribute relation_name.
-
#relation_result_set ⇒ Object
readonly
Returns the value of attribute relation_result_set.
Instance Method Summary collapse
- #assign_attribute(object, attribute_name, value) ⇒ Object
-
#initialize(object, record, relation_name, relation_result_set, mapping) ⇒ Relation
constructor
A new instance of Relation.
- #relation_repo ⇒ Object
Constructor Details
#initialize(object, record, relation_name, relation_result_set, mapping) ⇒ Relation
Returns a new instance of Relation.
7 8 9 10 11 12 13 |
# File 'lib/preserves/mapper/relation.rb', line 7 def initialize(object, record, relation_name, relation_result_set, mapping) @object = object @record = record @relation_name = relation_name @relation_result_set = relation_result_set @mapping = mapping end |
Instance Attribute Details
#mapping ⇒ Object (readonly)
Returns the value of attribute mapping.
5 6 7 |
# File 'lib/preserves/mapper/relation.rb', line 5 def mapping @mapping end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/preserves/mapper/relation.rb', line 5 def object @object end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
5 6 7 |
# File 'lib/preserves/mapper/relation.rb', line 5 def record @record end |
#relation_name ⇒ Object (readonly)
Returns the value of attribute relation_name.
5 6 7 |
# File 'lib/preserves/mapper/relation.rb', line 5 def relation_name @relation_name end |
#relation_result_set ⇒ Object (readonly)
Returns the value of attribute relation_result_set.
5 6 7 |
# File 'lib/preserves/mapper/relation.rb', line 5 def relation_result_set @relation_result_set end |
Instance Method Details
#assign_attribute(object, attribute_name, value) ⇒ Object
19 20 21 |
# File 'lib/preserves/mapper/relation.rb', line 19 def assign_attribute(object, attribute_name, value) object.send("#{attribute_name}=", value) end |
#relation_repo ⇒ Object
15 16 17 |
# File 'lib/preserves/mapper/relation.rb', line 15 def relation_repo @relation_repo ||= relation_settings.fetch(:repository) # TODO: Need a default. end |