options_provider | R Documentation |
Construct a module provider intended for defining modules that can be used as general purpose options and configuration containers.
options_provider(...)
... |
Named arguments used as default options. If void, no default option is set. |
A module provider which exposes an R environment. The default options arguments, if any, are used to assign the values to their corresponding names in the returned environment.
name %provides_options% options
It is considered a very bad practice to define, touch, undefine, load, make, reset, or perform any other operation from within a module definition that may alterate the internal state of modulr.
%<=%
, define
, make
,
%provides%
, %requires%
,
reset
, and touch
.
reset()
"foo/config" %provides% options_provider(upper = FALSE)
"foo" %requires% list(config = "foo/config") %provides% {
function() casefold("foo", upper = config$upper)
}
foo %<=% "foo"
foo()
config %<=% "foo/config"
config$upper <- TRUE
foo()
"foo/config" %provides_options% list(upper = FALSE)
foo %<=% "foo"
foo()
touch("foo/config")
"foo/config" %provides_options% list(upper = FALSE)
foo %<=% "foo"
foo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.