Restore non-default values from the given hash.

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

 === Returns
 self
484146
def restore(hash)
      self.configuration = hash.reject { |key, value| config_contexts.key?(key) }
      config_contexts.each do |key, config_context|
        if hash.key?(key)
          config_context.restore(hash[key])
        else
          config_context.reset
        end
      end
      config_context_lists.each do |key, meta|
        meta[:values] = []
        if hash.key?(key)
          hash[key].each do |val|
            context = define_context(meta[:definition_blocks])
            context.restore(val)
            meta[:values] << context
          end
        end
      end
      config_context_hashes.each do |key, meta|
        meta[:values] = {}
        if hash.key?(key)
          hash[key].each do |vkey, val|
            context = define_context(meta[:definition_blocks])
            context.restore(val)
            meta[:values][vkey] = context
          end
        end
      end
    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
1024658
def values_to_hash(values, file)
      @hash = {}
      values.each do |key, value|
        unless KEYS.include?(key)
          fail "Unrecognized key #{key} for #{feature}, #{name} in #{file}"
        end
        case key
        when 'auto_default'
          @auto_default = value ? true : false
        when 'data_format', 'get_data_format', 'set_data_format'
          @hash[key] = value.to_sym
        when 'default_only'
          @default_only = true
          # default_value overrides default_only
          @hash['default_value'] ||= value
        when 'multiple'
          @multiple = boolean_default_true(value)
        when 'kind'
          fail "Unknown 'kind': '#{value}'" unless KINDS.include?(value)
          @kind = value.to_sym
        when 'os_version'
          @os_version = value
        else
          # default_value overrides default_only
          @default_only = false if key == 'default_value'
          @hash[key] = value
        end
      end

      # Inherit general to specific if needed
      if @hash.key?('data_format')
        @hash['get_data_format'] = @hash['data_format'] \
          unless @hash.key?('get_data_format')
        @hash['set_data_format'] = @hash['data_format'] \
          unless @hash.key?('set_data_format')
      end
      if @hash.key?('context')
        @hash['get_context'] = @hash['context'] unless @hash.key?('get_context')
        @hash['set_context'] = @hash['context'] unless @hash.key?('set_context')
      end
      if @hash.key?('value')
        @hash['get_value'] = @hash['value'] unless @hash.key?('get_value')
        @hash['set_value'] = @hash['value'] unless @hash.key?('set_value')
      end

      @hash.delete_if { |key, _| key != 'default_value' } if @default_only
    end
165426
def update_attributes_without_saving(hash)
      hash.each do |k, v|
        raise NoMethodError, "#{k}= method not available, use property :#{k}" unless self.respond_to?("#{k}=")
      end      
      hash.each do |k, v|
        self.send("#{k}=",v)
      end
    end
1344668
def reset
      self.configuration = Hash.new
      config_contexts.values.each { |config_context| config_context.reset }
    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
416823
def update_hash_from_str(hsh, str_input):
    
    byte_input = str(str_input).encode("UTF-8")
    hsh.update(byte_input)
1351137
def restore(self, name, value, pttl=0):
        
        with self.pipe as pipe:
            res = pipe.restore(self.redis_key(name), ttl=pttl, value=value)
            f = Future()

            def cb():
                f.set(self.valueparse.decode(res.result))

            pipe.on_execute(cb)
            return f
956426
public function regenerateHash()
    {
        $this->hashWorkingRecord->{$this->hashDbField} = $this->encrypt();

        if ($this->hashMustBeUnique && !$this->hasUniqueHash()) {
            $this->regenerateHash();
        }
    }
1358218
def to_h

      p = HashParse.new
      t = HashTransform.new

      h_str = self.clone
      h_str.strip!
      t.apply(p.parse(self.strip))

    end
335181
public void reset() {
        super.reset();

        /* SHA-256 initial hash value
         * The first 32 bits of the fractional parts of the square roots
         * of the first eight prime numbers
         */

        H1 = 0x6a09e667;
        H2 = 0xbb67ae85;
        H3 = 0x3c6ef372;
        H4 = 0xa54ff53a;
        H5 = 0x510e527f;
        H6 = 0x9b05688c;
        H7 = 0x1f83d9ab;
        H8 = 0x5be0cd19;

        xOff = 0;
        for (int i = 0; i != X.length; i++) {
            X[i] = 0;
        }
    }
221373
def stringify( hash )

            keys = @sorted ? hash.keys.sort : hash.keys
            vals = keys.map{ |key|
                val = ''
                if hash[key].kind_of?( Array ) 
                    val = rotate( hash[key] )
                elsif hash[key].kind_of?( Hash )
                    val = @sorted ? hash[key].keys.sort[0] : hash[key].keys[0]
                else
                    val = hash[key]
                end
                "#{key}: #{val}"
            }
            return vals.join( '; ' ) + (vals.length ? ';' : '')

        end
611315
def hash_to_liquid(hash)
      hash.map { |key, value| [key.to_s, empty2nil(value)] }.to_h
    end
1123515
def indifferent_hash
      Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
    end
931419
def previous_hashes(self) -> Optional[Iterable[Hash32]]:
        
        return self.get_prev_hashes(self.header.parent_hash, self.chaindb)
1185467
def indifferent!(hash)
      unless hash.is_a?(Hash)
        return
      end

      #set the default proc to allow the key to be either string or symbol if a matching key is found.
      hash.default_proc = proc do |h, k|
        if h.key?(k.to_s)
          h[k.to_s]
        elsif h.key?(k.to_sym)
          h[k.to_sym]
        else
          nil
        end
      end

      #recursively process any child hashes
      hash.each do |key,value|
        if hash[key] != nil
          if hash[key].is_a?(Hash)
            indifferent!(hash[key])
          elsif hash[key].is_a?(Array)
            indifferent_array!(hash[key])
          end
        end
      end

      hash
    end
789941
def to_hash
      result = {
        name: @name,
        value: @value,
        domain: @domain,
        path: @path,
        created_at: @created_at
      }
      {
        expiry: @expiry,
        secure: (true if @secure),
        http_only: (true if @http_only),
        version: (@version if version != 0),
        comment: @comment,
        comment_url: @comment_url,
        discard: (true if @discard),
        ports: @ports
      }.each do |name, value|
        result[name] = value if value
      end

      result
    end