You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: settings.rb
    path of file: ./repos/manageiq/lib/vmdb
    
    the code of the file until where you have to start completion: require 'config'
require_dependency 'patches/config_patch'
require_dependency 'vmdb/settings/database_source'
require_dependency 'vmdb/settings/hash_differ'
require_dependency 'vmdb/settings_walker'

module Vmdb
  class Settings
    extend Vmdb::SettingsWalker::ClassMethods

    class ConfigurationInvalid < StandardError
 
    
    def self.save!(resource, hash)
      new_settings = build_without_local(resource).load!.merge!(hash.deep_symbolize_keys).to_hash
      replace_magic_values!(new_settings, resource)

      valid, errors = validate(new_settings)
      raise ConfigurationInvalid.new(errors) unless valid # rubocop:disable Style/RaiseArgs

      parent_settings = parent_settings_without_local(resource).load!.to_hash
      diff = HashDiffer.diff(parent_settings, new_settings)
      encrypt_passwords!(diff)
      deltas = HashDiffer.diff_to_deltas(diff)
      apply_settings_changes(resource, deltas)
    end