Yaml

shampoo.yaml.Yaml
object Yaml

Provides YAML utilities.

import scala.language.implicitConversions

import shampoo.yaml.{ *, given }

// Create YAML mapping
val user = Yaml.map("id" -> 1000, "name" -> "lupita")

// Create YAML sequence
val info = Yaml.seq(user, "/home/lupita", 1024)

// Load YAML
val root = Yaml.load("{ id: 0, name: root }")

case class User(id: Int, name: String)

given userRepresenter: YamlRepresenter[User] =
  user => Yaml.map("id" -> user.id, "name" -> user.name)

// Represent value to YAML
val nobody = Yaml.toYaml(User(65534, "nobody"))

// Dump YAML to stdout
Yaml.dump(nobody, System.out)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Yaml.type

Members list

Value members

Concrete methods

def dump(yaml: YamlNode): String

Dumps YAML.

Dumps YAML.

Attributes

def dump(yaml: YamlNode, output: Writer): Unit

Dumps YAML to supplied output.

Dumps YAML to supplied output.

Attributes

def dump(yaml: YamlNode, output: OutputStream): Unit

Dumps YAML to supplied output.

Dumps YAML to supplied output.

Attributes

def dump(yaml: YamlNode, output: File): Unit

Dumps YAML to supplied output.

Dumps YAML to supplied output.

Attributes

def dump(yaml: YamlNode, output: Path): Unit

Dumps YAML to supplied output.

Dumps YAML to supplied output.

Attributes

def load(input: String): YamlNode

Loads YAML mapping.

Loads YAML mapping.

Attributes

Throws
YamlException

if YAML cannot be loaded from input

def load(input: Reader): YamlNode

Loads YAML mapping.

Loads YAML mapping.

Attributes

Throws
YamlException

if YAML cannot be loaded from input

def load(input: InputStream): YamlNode

Loads YAML mapping.

Loads YAML mapping.

Attributes

Throws
YamlException

if YAML cannot be loaded from input

def load(input: File): YamlNode

Loads YAML mapping.

Loads YAML mapping.

Attributes

Throws
YamlException

if YAML cannot be loaded from input

def load(input: Path): YamlNode

Loads YAML mapping.

Loads YAML mapping.

Attributes

Throws
YamlException

if YAML cannot be loaded from input

def map(pairs: (String, YamlNode)*): YamlMapping

Creates YAML mapping with supplied key-node pairs.

Creates YAML mapping with supplied key-node pairs.

Attributes

def seq(nodes: YamlNode*): YamlSequence

Creates YAML sequence with supplied nodes.

Creates YAML sequence with supplied nodes.

Attributes

def toYaml[T](data: T)(using representer: YamlRepresenter[T]): YamlNode

Represents data.

Represents data.

Value parameters

data

native data

representer

data representer

Attributes