lib/onix/onix_message.rb
# initialize hash between ID and product object
initialize hash between ID and product object
initialize hash between ID and product object
def init_vault
      @vault={}
      @products.each do |product|
        product.identifiers.each do |ident|
          @vault[ident.uniq_id]=product
        end
      end
      @products.each do |product|
        product.related.each do |rel|
          rel.identifiers.each do |ident|
            if @vault[ident.uniq_id]
              rel.product=@vault[ident.uniq_id]
            end
          end
        end
        product.parts.each do |prt|
          prt.identifiers.each do |ident|
            if @vault[ident.uniq_id]
              prt.product=@vault[ident.uniq_id]
            end
          end
        end
      end
    end
def init_vault @vault = { } @products . each do | product | product . identifiers . each do | ident | @vault [ ident . uniq_id ] = product end end @products . each do | product | product . related . each do | rel | rel . identifiers . each do | ident | if @vault [ ident . uniq_id ] rel . product = @vault [ ident . uniq_id ] end end end product . parts . each do | prt | prt . identifiers . each do | ident | if @vault [ ident . uniq_id ] prt . product = @vault [ ident . uniq_id ] end end end end end
initialize hash between ID and product object
initialize hash between ID and product object