Merge an incoming hash with our config options

 === Parameters
 hash<Hash>: a hash in the same format as output by save.

 === Returns
 self
481182
def merge!(hash)
      hash.each do |key, value|
        if config_contexts.key?(key)
          # Grab the config context and let internal_get cache it if so desired
          config_contexts[key].restore(value)
        else
          configuration[key] = value
        end
      end
      self
    end
57221
def create_versions_hash
      hash = Hash.new { |h, k| h[k] = [] }

      versions.each do |version|
        hash[version[0]] << version
      end

      hash
    end
329760
def to_hash(args = {}) # :nodoc:
      args ||= {}

      if args[:nested]
        {'url' => self[:@url] || self[:url]}
      else
        hash = super
        hash.merge!('@version' => self['@version']) unless new_record?
        {self.class.json_name => hash}
      end
    end
152229
public static Hash merge(Hash a, Hash b) {
        try {
            MessageDigest digest = MessageDigest.getInstance("SHA-256");
            digest.update(a.bytes);
            return Hash.createFromSafeArray(digest.digest(digest.digest(b.bytes)));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
322139
def options_hash_to_string(options)
      result = ''
      options.sort_by { |key, _| OPTION_ORDER.find_index(key) || -1 }.each do |key, value|
        if value
          result += "set #{OptionHandling.option_to_string(key, value)}\n"
        else
          result += "unset #{key}\n"
        end
      end
      result
    end
169813
def deep_merge!(other_hash)
      other_hash.each_pair do |k, v|
        tv      = self[k]
        self[k] = if v.kind_of?(::Hash) then
                    if tv.kind_of?(::Hash) then
                      Configoro::Hash.new(tv).deep_merge!(v)
                    else
                      Configoro::Hash.new(v)
                    end
                  else
                    v
                  end
      end
      self
    end
681837
def to_hash
      result = {}
      @lines.entries.each do |section|
        result[section.key] ||= {}
        section.entries.each do |option|
          opts = Array(option)
          val = opts.map { |o| o.respond_to?(:value) ? o.value : o }
          val = val.size > 1 ? val : val.first
          result[section.key][opts.first.key] = val
        end
      end
      result
    end
457958
def flat_hash(hash, keys = [])
      new_hash = {}

      hash.each do |key, val|
        new_hash[format_key(keys + [key])] = val unless
          val.is_a?(Array) || val.is_a?(Hash)
        new_hash.merge!(flat_hash(val, keys + [key])) if val.is_a? Hash

        if val.is_a? Array
          val.each do |v|
            if v.is_a? Hash
              new_hash.merge!(flat_hash(v, keys + [key])) do |key, f, s|
                Array(f) << s
              end
            else
              formatted_key = format_key(keys + [key])
              new_hash[formatted_key] =
                new_hash[formatted_key] ? (Array(new_hash[formatted_key]) << v) : v
            end
          end
        end
      end

      new_hash
    end
124274
def mix_hash(self, data: bytes):
        
        self.h = self.noise_protocol.hash_fn.hash(self.h + data)
1300360
def merge!(another)
      configs = self.configs
      another.each_pair do |key, value|
        if config = configs[key]
          config.set(receiver, value)
        else
          store[key] = value
        end
      end
      self
    end
526514
def to_hash(options = {})
      out = {}
      each_key do |k|
        assignment_key =
          if options[:stringify_keys]
            k.to_s
          elsif options[:symbolize_keys]
            k.to_s.to_sym
          else
            k
          end
        if self[k].is_a?(Array)
          out[assignment_key] ||= []
          self[k].each do |array_object|
            out[assignment_key] << maybe_convert_to_hash(array_object, options)
          end
        else
          out[assignment_key] = maybe_convert_to_hash(self[k], options)
        end
      end
      out
    end
475683
def deep_merge!(other_hash, &block)
      other_hash.each_pair do |current_key, other_value|
        this_value = self[current_key]

        self[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)
          _this_value = HashExt.new.replace(this_value)
          _this_value.deep_merge(other_value, &block).to_h
        else
          if block_given? && key?(current_key)
            block.call(current_key, this_value, other_value)
          else
            other_value
          end
        end
      end

      self
    end
664583
def to_hash
      result = {}

      @values.keys.each do |field_name|
        value = __send__(field_name)
        hashed_value = value.respond_to?(:to_hash_value) ? value.to_hash_value : value
        result.merge!(field_name => hashed_value)
      end

      result
    end
1059347
def normalize_keys(hash)
        hash.inject({}) do |options, (key, value)|
          options[(underscore(key) rescue key) || key] = normalize_value(value)
          options
        end
      end
979972
def create_hash(self, initial, capacity, error):
        
        self.hash = 0
        self.hashbits, self.num_hashes = self._optimal_size(capacity, error)

        if len(initial):
            if type(initial) == str:
                self.add(initial)
            else:
                for t in initial:
                    self.add(t)
364627
def hash(self, hash):
        
        self.md5 = None
        self.sha1 = None
        self.sha256 = None
        if (hash is None):
            return
        hash_seen = set()
        errors = []
        for entry in hash.split():
            (hash_type, value) = entry.split(':', 1)
            if (hash_type in hash_seen):
                errors.append("Ignored duplicate hash type %s" % (hash_type))
            else:
                hash_seen.add(hash_type)
                if (hash_type == 'md5'):
                    self.md5 = value
                elif (hash_type == 'sha-1'):
                    self.sha1 = value
                elif (hash_type == 'sha-256'):
                    self.sha256 = value
                else:
                    errors.append("Ignored unsupported hash type (%s)" %
                                  (hash_type))
        if (len(errors) > 0):
            raise ValueError(". ".join(errors))
736481
def options
      Hash[*Vault::Configurable.keys.map do |key|
        [key, instance_variable_get(:"@#{key}")]
      end.flatten]
    end