resolve_fallback: Resolve a fallback

View source: R/resolve.R

resolve_fallbackR Documentation

Resolve a fallback

Description

Resolves the value of a fallback chain defined with fallback().

Usage

resolve_fallback(fallback)

Arguments

fallback

A fallback chain defined with fallback().

Examples


f <- function(x = fallback(TRUE)) {
  resolve_fallback(x)$value
}

f() # with no config files in place, this resolves to the terminal fallback.
dir <- tempdir()
dir1 <- fs::path(dir, "dir1")
fs::dir_create(dir1)
yaml::write_yaml(list(frog = 100), fs::path(dir1, "config.yaml"))


g <- function(frog = fallback(letters, hierarchy = dir1)) {
  resolve_fallback(frog)$value
}

# this should resolve to the fallback declared in dir1
g()

lorenzwalthert/fallback documentation built on April 19, 2022, 1:51 p.m.