def marshal(file, data, format: :auto)
      file_ext = ::File.extname(file)
      ext = (format == :auto ? file_ext : ".#{format}")
      self.extname  = file_ext
      self.filename = ::File.basename(file, file_ext)

      case ext
      when *EXTENSIONS[:yaml]
        load_write_dep('yaml', ext)
        YAML.dump(self.class.normalize_hash(data, :to_s))
      when *EXTENSIONS[:json]
        load_write_dep('json', ext)
        JSON.pretty_generate(data)
      when *EXTENSIONS[:toml]
        load_write_dep('toml', ext)
        TOML::Generator.new(data).body
      when *EXTENSIONS[:ini]
        Config.generate(data)
      else
        raise WriteError, "Config file format `#{ext}` is not supported."
      end
    end
def marshal(file, data, format: :auto)
      file_ext = ::File.extname(file)
      ext = (format == :auto ? file_ext : ".#{format}")
      self.extname  = file_ext
      self.filename = ::File.basename(file, file_ext)

      case ext
      when *EXTENSIONS[:yaml]
        load_write_dep('yaml', ext)
        YAML.dump(self.class.normalize_hash(data, :to_s))
      when *EXTENSIONS[:json]
        load_write_dep('json', ext)
        JSON.pretty_generate(data)
      when *EXTENSIONS[:toml]
        load_write_dep('toml', ext)
        TOML::Generator.new(data).body
      when *EXTENSIONS[:ini]
        Config.generate(data)
      else
        raise WriteError, "Config file format `#{ext}` is not supported."
      end
    end
Marshal data hash into a configuration file content

 @return [String]

 @api private