construct_action {scenes} | R Documentation |
Generate the check function for an action, and use it to create a
scene_action
object.
construct_action(fn, ..., negate = FALSE, methods = "GET")
fn |
A function that takes a request (and potentially other arguments)
and returns |
... |
Additional parameters passed on to |
negate |
If |
methods |
The http methods which needs to be accepted in order for this function to make sense. Default "GET" should work in almost all cases. |
A scene_action
object.
simple_function <- function(request) {
!missing(request) && length(request) > 0
}
sample_action <- construct_action(simple_function)
sample_action$check_fn()
sample_action$check_fn(list())
sample_action$check_fn(list(a = 1))