KlipManager

object KlipManager

A helper class to assist in reading and writing persisted klips

Functions

klip
Link copied to clipboard
fun klip(context: KlipContext, attributes: Map<String, String>, source: () -> String): Klip

Writes or returns klip depending on the working mode.

readKlip
Link copied to clipboard
fun readKlip(path: String, key: String, attributes: Map<String, String>, source: () -> String): Klip

Reads a klip from a klip file specified by path under given key. If such klip is not found, a value provided by source is persisted and returned instead.

stringifyKlip
Link copied to clipboard
fun stringifyKlip(key: String, attributes: Map<String, String>, source: () -> String): String

Converts a key and a klip provided by source to a writable form that's safe to append to klip file.

writeKlip
Link copied to clipboard
fun writeKlip(path: String, key: String, attributes: Map<String, String>, source: () -> String): Klip

Writes and returns a klip provided by source to a klip file specified by path under given key.