class PIM::Services::DataModelLoaders::DBMFileLoader
Public Class Methods
new()
click to toggle source
Calls superclass method
PIM::Services::DataModelLoaders::AbstractFileLoader::new
# File services.rb, line 1759 def initialize super file_extensions: DBMDatabase::TYPE_GDBM_EXTNAME, cached: false # Ensure all databases are closed when the request exits PIM.at_request_exit("#{DBMFileLoader}.close") { self.close } end
Public Instance Methods
close_repository(database)
click to toggle source
# File services.rb, line 1771 def close_repository database database.close end
get_from_repository(database, request, cached: false, return_nil: true)
click to toggle source
# File services.rb, line 1775 def get_from_repository database, request, cached: false, return_nil: true return nil if request.nil? base_key = get_base_key(request) # If no keys were specified, return the entry for the base_key itself. # Note that in this case a 'parent' exists! if request.keys.empty? # Without keys, the returned value is supposed to be an Array of keys return database.get(base_key) end result = {} request.keys.each do |key| db_key = [base_key, key].join(':') # Note: Since the DBMFileLoader is always the last loader to check, # we can assume that any non existing value for key really does not exist! # Thus, we do not have to check if the database actually includes the key! # Otherwise, we need to check the 'return_nil' argument! result[key] = database.get(db_key) end # Convert result, if necessary result = request.convert_result(result) return result end
open_repository(filename)
click to toggle source
# File services.rb, line 1767 def open_repository filename DBMDatabase.new(filename, type: DBMDatabase::TYPE_GDBM) end