Sha256: e7e7161e5e822d9236364f943fd0add53b66f4e550ba627233c168ba9085697f
Contents?: true
Size: 1.86 KB
Versions: 3
Compression:
Stored size: 1.86 KB
Contents
require "inventory_refresh/logging" require "inventory_refresh/save_collection/saver/batch" require "inventory_refresh/save_collection/saver/concurrent_safe" require "inventory_refresh/save_collection/saver/concurrent_safe_batch" require "inventory_refresh/save_collection/saver/default" module InventoryRefresh::SaveCollection class Base class << self include InventoryRefresh::Logging # Saves one InventoryCollection object into the DB. # # @param ems [ExtManagementSystem] manger owning the InventoryCollection object # @param inventory_collection [InventoryRefresh::InventoryCollection] InventoryCollection object we want to save def save_inventory_object_inventory(ems, inventory_collection) logger.debug("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("Saving collection #{inventory_collection}, for the manager: '#{ems.name}'...Complete") inventory_collection.saved = true end private # Saves one InventoryCollection object into the DB using a configured saver_strategy class. # # @param inventory_collection [InventoryRefresh::InventoryCollection] InventoryCollection object we want to save def save_inventory(inventory_collection) saver_class = "InventoryRefresh::SaveCollection::Saver::#{inventory_collection.saver_strategy.to_s.camelize}" saver_class.constantize.new(inventory_collection).save_inventory_collection! end end end end
Version data entries
3 entries across 3 versions & 1 rubygems