Class: InventoryRefresh::SaveCollection::Base

Inherits:
Object
  • Object
show all
Extended by:
Logging
Defined in:
lib/inventory_refresh/save_collection/base.rb

Direct Known Subclasses

Sweeper, TopologicalSort

Class Method Summary collapse

Methods included from Logging

logger

Class Method Details

.save_inventory_object_inventory(ems, inventory_collection) ⇒ Object

Saves one InventoryCollection object into the DB.

Parameters:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/inventory_refresh/save_collection/base.rb', line 15

def save_inventory_object_inventory(ems, inventory_collection)
  return if skip?(inventory_collection)

  logger.debug("----- BEGIN ----- Saving collection #{inventory_collection} of size #{inventory_collection.size} to"\
               " the database, for the manager: '#{ems.name}'...")

  if inventory_collection.custom_save_block.present?
    logger.debug("Saving collection #{inventory_collection} using a custom save block")
    inventory_collection.custom_save_block.call(ems, inventory_collection)
  else
    save_inventory(inventory_collection)
  end
  logger.debug("----- END ----- Saving collection #{inventory_collection}, for the manager: '#{ems.name}'...Complete")
  inventory_collection.saved = true
end