YAMLClass-class: Query a YAML object for a certain parameter.

Description Fields Methods Examples

Description

If the object has the param, then return it. If the param is unknown, create it with the given default value and return the default.

Fields

yamlObj

A Yaml object as created by yaml.load

Methods

getYAML(param_name, default)

Query this YAML object for a certain parameter and return its value. If it does not exist it is created with a default value.

setYAML(param_name, value)

Set a YAML parameter to a certain value. Overwrites the old value or creates a new entry if hithero unknown.

writeYAML(filename)

Write YAML config (including some documentation) to a YAML file. Returns TRUE on success (always), unless writing the file generates an error.

Examples

1
2
3
4
5
6
    yc = YAMLClass$new(list())
    val = yc$getYAML("cat$subCat", "someDefault")
    val  ## someDefault
    val = yc$setYAML("cat$subCat", "someValue")
    val  ## someValue
    yc$getYAML("cat$subCat", "someDefault") ## still 'someValue' (since its set already)

PTXQC documentation built on June 10, 2017, 1:03 a.m.

Search within the PTXQC package
Search all R packages, documentation and source code