INNER CODE UNIT · Swift

asYaml

peripheryapp/periphery · Sources/Configuration/Configuration.swift:172

    public func asYaml() throws -> String {
        var config: [String: Any?] = [:]

        for setting in settings where setting.hasNonDefaultValue {
            config[setting.key] = setting.wrappedValue
        }

        return try Yams.dump(object: config)
    }

    public func save(to path: FilePath = defaultConfigurationFile) throws {
        let data = try asYaml().data(using: .utf8)
        FileManager.default.createFile(atPath: path.string, contents: data)
    }

    public func load(from path: FilePath?) throws {
        guard let path = try configurationPath(withUserProvided: path) else { return }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…