register_preprocessor: Register a resource preprocessor

Description Usage Arguments Examples

Description

Register a resource preprocessor

Usage

1

Arguments

path

character. The prefix to look for in the director.

preprocessor

function.

overwrite

logical. If TRUE, register_preprocessor will overwrite the route instead of erroring if the path already has a registered preprocessor. The default is FALSE.

Examples

1
2
3
4
5
6
7
## Not run: 
  d <- director("some/project")
  d$register_preprocessor('models', function() { print("I am a ", resource, ", a model!") })
  r <- d$resource("models/some_model.R")
  r$value() # Will print: I am a models/some_model, a model!

## End(Not run)

syberia/director documentation built on May 30, 2019, 10:40 p.m.