Class: ArDocStore::Attributes::AssignEmbedsManyAttributes
- Inherits:
-
Object
- Object
- ArDocStore::Attributes::AssignEmbedsManyAttributes
- Defined in:
- lib/ar_doc_store/attributes/embeds_many.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent, class_name, assn_name, models, values) ⇒ AssignEmbedsManyAttributes
constructor
A new instance of AssignEmbedsManyAttributes.
Constructor Details
#initialize(parent, class_name, assn_name, models, values) ⇒ AssignEmbedsManyAttributes
Returns a new instance of AssignEmbedsManyAttributes.
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ar_doc_store/attributes/embeds_many.rb', line 93 def initialize(parent, class_name, assn_name, models, values) @parent, @class_name, @assn_name, @models, @values = parent, class_name, assn_name, models, values @models ||= ArDocStore::EmbeddedCollection.new values.each { |value| value = value.symbolize_keys if value.key?(:id) process_existing_model(value) else next if value.values.all? { |value| value.nil? || value == '' } add(value) end } end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
92 93 94 |
# File 'lib/ar_doc_store/attributes/embeds_many.rb', line 92 def class_name @class_name end |
#models ⇒ Object
Returns the value of attribute models.
92 93 94 |
# File 'lib/ar_doc_store/attributes/embeds_many.rb', line 92 def models @models end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
92 93 94 |
# File 'lib/ar_doc_store/attributes/embeds_many.rb', line 92 def parent @parent end |