Register a resource preprocessor

register_preprocessor(path, preprocessor, overwrite = FALSE)

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

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! })