lib/model/the_record.rb
Add Items to a linked or embedded class

Parameter:

[array] the name of the property to work on
[item ]  what to add (optional)
[block]  has to provide an array of elements to add to the property

Example: add 10 elements to the property

   add_item_to_property :second_list do
       (0 .. 9).map do | s |
               SecondList.create label: s
       end  
   end


The method returns the model record itself. Thus nested initialisations are possible:
   
       ORD.create_classes([:base, :first_list, :second_list ]){ "V" }
       ORD.create_property :base, :first_list,  type: :linklist, linkedClass: :first_list
       ORD.create_property :base, :label, index: :unique
       ORD.create_property :first_list,  :second_list , type: :linklist, linkedClass: :second_list
       ORD.create_vertex_class :log
       (0 .. 9).each do | b |
          base= Base.create label: b, first_list: []
          base.add_item_to_property :first_list do
             (0 .. 9).map do | f |
                first = FirstList.create label: f, second_list: []
	         base.add_item_to_property :first_list , first
	         first.add_item_to_property :second_list do
	           (0 .. 9).map{| s |  SecondList.create label: s }
	         end    # add item  second_list
	      end      # 0..9 -> f
	   end        # add item  first_list
	end        # 0..9 -> b


Record#AddItemToProperty shines with its feature to specify records to insert in a block.

If only single Items are to  be inserted, use
  model_record.linklist << item 

Add Items to a linked or embedded class
Parameter.

[array] the name of the property to work on
[item ]  what to add (optional)
[block]  has to provide an array of elements to add to the property

add 10 elements to the property



The method returns the model record itself. Thus nested initialisations are possible.



Record#AddItemToProperty shines with its feature to specify records to insert in a block.

If only single Items are to  be inserted, use
model_record.linklist << item
Add Items to a linked or embedded class Parameter . [ array ] the name of the property to work on [ item ] what to add ( optional ) [ block ] has to provide an array of elements to add to the property add 10 elements to the property The method returns the model record itself . Thus nested initialisations are possible . Record#AddItemToProperty shines with its feature to specify records to insert in a block . If only single Items are to be inserted use model_record . linklist << item
def add_item_to_property array, *item
       item =  yield if block_given?
	if attributes.keys.include? array.to_s
	  item.each{|x| self.attributes[array].push x.to_orient }
	  update
	else
	  update array=> item 
	end	
  end
def add_item_to_property array , * item item = yield if block_given? if attributes . keys . include? array . to_s item . each { | x | self . attributes [ array ] . push x . to_orient } update else update array => item end end
Add Items to a linked or embedded class
Parameter:
Add Items to a linked or embedded class Parameter :
#  rescue NoMethodError #undefined method `<<' for nil:NilClass
array
<not_specific>
item
<not_specific>