Module: Dynamoid::Associations::Association
- Included in:
- HasOne, ManyAssociation, SingleAssociation
- Defined in:
- lib/dynamoid/associations/association.rb
Instance Attribute Summary collapse
-
#loaded ⇒ Object
Returns the value of attribute loaded.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #declaration_field_name ⇒ Object
- #declaration_field_type ⇒ Object
- #find_target ⇒ Object
-
#initialize(source, name, options) ⇒ Dynamoid::Association
Create a new association.
- #loaded? ⇒ Boolean
- #reset ⇒ Object
- #target ⇒ Object
Instance Attribute Details
#loaded ⇒ Object
Returns the value of attribute loaded.
9 10 11 |
# File 'lib/dynamoid/associations/association.rb', line 9 def loaded @loaded end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/dynamoid/associations/association.rb', line 9 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/dynamoid/associations/association.rb', line 9 def @options end |
#source ⇒ Object
Returns the value of attribute source.
9 10 11 |
# File 'lib/dynamoid/associations/association.rb', line 9 def source @source end |
Instance Method Details
#declaration_field_name ⇒ Object
51 52 53 |
# File 'lib/dynamoid/associations/association.rb', line 51 def declaration_field_name "#{name}_ids" end |
#declaration_field_type ⇒ Object
55 56 57 |
# File 'lib/dynamoid/associations/association.rb', line 55 def declaration_field_type :set end |
#find_target ⇒ Object
35 |
# File 'lib/dynamoid/associations/association.rb', line 35 def find_target; end |
#initialize(source, name, options) ⇒ Dynamoid::Association
Create a new association.
24 25 26 27 28 29 |
# File 'lib/dynamoid/associations/association.rb', line 24 def initialize(source, name, ) @name = name @options = @source = source @loaded = false end |
#loaded? ⇒ Boolean
31 32 33 |
# File 'lib/dynamoid/associations/association.rb', line 31 def loaded? @loaded end |
#reset ⇒ Object
46 47 48 49 |
# File 'lib/dynamoid/associations/association.rb', line 46 def reset @target = nil @loaded = false end |
#target ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/dynamoid/associations/association.rb', line 37 def target unless loaded? @target = find_target @loaded = true end @target end |