Store the Hash object as a Yaml file
 Supported options:
   :header         [string]: additional info to place in the header of the (stored) file
   :no_interaction [boolean]: do not interact
430858
def store_config(filepath, hash, options = {})
      content  = "# " + File.basename(filepath) + "\n"
      content += "# /!\\ DO NOT EDIT THIS FILE: it has been automatically generated\n"
      if options[:header]
        options[:header].split("\n").each { |line| content += "# #{line}" }
      end
      content += hash.to_yaml
      show_diff_and_write(content, filepath, options)
      # File.open( filepath, 'w') do |f|
      #     f.print "# ", File.basename(filepath), "\n"
      #     f.puts "# /!\\ DO NOT EDIT THIS FILE: it has been automatically generated"
      #     if options[:header]
      #         options[:header].split("\n").each do |line|
      #             f.puts "# #{line}"
      #         end
      #     end
      #     f.puts hash.to_yaml
      # end
    end
1322549
def store_shtprops   # :nodoc:
    record      = 0x1044     # Record identifier.
    length      = 0x0004     # Number of bytes to follow.
    grbit       = 0x000E     # Option flags.
    empty_cells = 0x0000     # Empty cell handling.

    grbit = 0x000A if @embedded

    store_simple(record, length, grbit, empty_cells)
  end
1358184
def to_yaml
      sorted_facts = @facts.sort.to_h
      facts_hash_with_expanded_values = Hash[sorted_facts.collect { |k, v| [k, v.value] }]
      YAML.dump(facts_hash_with_expanded_values)
    end
1154905
def load(file = '.cookies')
      YAML.safe_load(IO.read(file), [::Symbol, ::Time]).each do |c|
        add(c.delete(:name), c.delete(:value), c)
      end
    end
123577
def write_config_file
      return unless config_file

      File.open(config_file, 'w') do |f|
        f.puts(data.delete_if { |_, v| v.nil? }.to_yaml)
      end
    end
1033317
def save(dir = Dir.pwd, options = {})
      prefix = options[:prefix] if options.key?(:prefix)
      write_file(File.join(dir, "#{prefix}#{lang}.yml"), options)
    end
978241
def store(self, config_file):
        

        selfcopy = copy.deepcopy(self)
        selfcopy.filter_exports()

        with open(config_file, 'w') as outf:
            yaml.dump(
                selfcopy.node,
                outf,
                width=80,
                indent=4,
                default_flow_style=False,
                Dumper=ConfigDumper)
295701
def save_hash(self, repo: str, branch: str, git_repo: Repo):
        
        if self.single_pull:
            repo_id = self.repo_id(repo)
            self._current_hashes[repo_id][branch] = git_repo.head.object.hexsha
158448
def serializable_hash(*)
      h               = attributes.extract!('included')
      h['data']       = { 'type'       => self.class.to_s.underscore.sub('esp/', '').pluralize,
                          'attributes' => changed_attributes.except('id', 'type', 'created_at', 'updated_at', 'relationships') }
      h['data']['id'] = id if id.present?
      h
    end
221191
def put_hash(name, hash)
      file_name = File.join(@db_dir, name + '.json')
      begin
        RobustFile.write(file_name, hash.to_json)
      rescue IOError => e
        PEROBS.log.fatal "Cannot write hash file '#{file_name}': #{e.message}"
      end
    end
3301
def options
      Hash[
        DeskApi::Configuration.keys.map do |key|
          [key, instance_variable_get(:"@#{key}")]
        end
      ]
    end
684913
def set_header(self, key: str, value: str) -> None:
        
        self.headers[key] = value
526007
def save
      if data = session[Evercookie.hash_name_for_get]
        if data[:key] && cookies[data[:key]]
          session[Evercookie.hash_name_for_saved] =
              { data[:key] => cookies[data[:key]] }
        end
      end
      render nothing: true
    end
1111426
def save(file=nil,format=nil,opts={})
      format = @format if format.nil?
      file = @filename if file.nil?

      if format != FORMAT_BINARY && format != FORMAT_XML && format != FORMAT_PLAIN
        raise CFFormatError.new("Format #{format} not supported, use List::FORMAT_BINARY or List::FORMAT_XML")
      end

      if(!File.exists?(file)) then
        raise IOError.new("File #{file} not writable!") unless File.writable?(File.dirname(file))
      elsif(!File.writable?(file)) then
        raise IOError.new("File #{file} not writable!")
      end

      opts[:root] = @value
      opts[:formatted] = @formatted unless opts.has_key?(:formatted)

      prsr = @@parsers[format-1].new

      content = prsr.to_str(opts)

      File.open(file, 'wb') {
        |fd|
        fd.write content
      }
    end
355910
def process_hash_row(hsh)
      if @headers.any?
        keys_or_values = hsh.values
        @row_id = hsh[:row_id]
      else
        keys_or_values = hsh.keys.map(&:to_s)
      end

      file_line = keys_or_values.join(',')
      validated_line = utf_filter(check_utf(file_line))
      res = line_parse(validated_line)
      res
    end
462995
def parse_yaml(file)
      file_content = File.exist?(file) ? ERB.new(File.read(file)).result : '---'

      config = YAML.load(file_content) || {}
      env    = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['APP_CONFIG_ENV']

      config_from config['default'], config[env]
    end
500624
def store(options)
      @options = self.options.merge(options)
      FileUtils.touch(@path)
      File.open(@path, 'w') do |file|
        YAML.dump(@options, file)
      end
    end