working on deployment methods
This commit is contained in:
parent
600aa1962a
commit
620be25588
@ -16,4 +16,5 @@ Config/testthat/edition: 3
|
||||
Imports:
|
||||
cli,
|
||||
js,
|
||||
rlang
|
||||
rlang,
|
||||
Rserve
|
||||
|
||||
@ -8,15 +8,20 @@ S3method(get_type,ts_function)
|
||||
S3method(get_type,ts_object)
|
||||
S3method(print,ts_function)
|
||||
S3method(print,ts_object)
|
||||
S3method(ts_app,default)
|
||||
S3method(ts_app,list)
|
||||
S3method(ts_app,ts_function)
|
||||
S3method(ts_compile,character)
|
||||
S3method(ts_compile,default)
|
||||
S3method(ts_compile,ts_function)
|
||||
export(check_type)
|
||||
export(get_type)
|
||||
export(is_ts_object)
|
||||
export(ts_app)
|
||||
export(ts_character)
|
||||
export(ts_compile)
|
||||
export(ts_dataframe)
|
||||
export(ts_deploy)
|
||||
export(ts_factor)
|
||||
export(ts_function)
|
||||
export(ts_integer)
|
||||
|
||||
25
R/function.R
25
R/function.R
@ -97,3 +97,28 @@ print.ts_function <- function(x, ...) {
|
||||
cli::cli_text("Return type:")
|
||||
cat(x$result$return_type)
|
||||
}
|
||||
|
||||
#' Generate an Rserve app from a ts function
|
||||
#'
|
||||
#' Anything that is not a function simply returns itself.
|
||||
#' However, functions are wrapped with `Rserve::ocap()`,
|
||||
#' and the result is subsequently wrapped with `ts_app()`.
|
||||
#' @param x A ts function object (`ts_function()`)
|
||||
#' @export
|
||||
#' @md
|
||||
ts_app <- function(x) UseMethod("ts_app")
|
||||
|
||||
#' @export
|
||||
ts_app.default <- function(x) {
|
||||
x
|
||||
}
|
||||
|
||||
#' @export
|
||||
ts_app.list <- function(x) {
|
||||
lapply(x, ts_app)
|
||||
}
|
||||
|
||||
#' @export
|
||||
ts_app.ts_function <- function(x) {
|
||||
Rserve::ocap(function(...) ts_app(x$call(...)))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user