patch_template: Create a patch from environment injected objects and body.

Description Usage Arguments Value Examples

Description

Create a patch from environment injected objects and body.

Usage

1
patch_template(provides, body)

Arguments

provides

list. Objects to inject into the patch's environment.

body

expression. The body to use for the patch.

Value

A patch with parent base environment and body body.

Examples

1
2
3
4
p <- objectdiff:::patch_template(list(a = 1), { a + object })
# function(object) { a + object } 
# with environment containing a = 1
stopifnot(p(1) == 2)

robertzk/objectdiff documentation built on May 27, 2019, 10:35 a.m.