Hand in hand with parsers, preprocessors are the heart of director. The idea is to allow the developer to do any additional stuff prior to sourcing an R file. For example, if some helper functions are desired or some operators should be overloaded for a DSL (domain-specific language), the preprocessor can perform this prior to sourcing the R file.
preprocessor(object, ..., parse. = TRUE)
| object | active_resource. See |
|---|---|
| ... | additional parameters to pass to the next layer in the resource parsing tower. |
| parse. | logical. Whether or not to apply the parser to the
resource. If |
The parsed resource if parse. = TRUE, and the preprocessed
resource otherwise.
To define a preprocessor for routes in a given path, you can use the
register_preprocessor method on the director object.
The parameters must be named object and ... due to
this method's inclusion in a tower.
register_preprocessor, active_resource,
tower