Skip to content

Commit 0e730f9

Browse files
committed
split source file into multiple parts
1 parent 4a16df4 commit 0e730f9

2 files changed

Lines changed: 45 additions & 44 deletions

File tree

R/application/app.R

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,4 @@ const app = function(name, analysis,
2828
);
2929
}
3030

31-
#' check of the required app slot
32-
#'
33-
const app_check.signature = function(app) {
34-
all(["name", "call"] in names(app));
35-
}
36-
37-
#' Check the function signature of the app function
38-
#'
39-
#' @param analysis a callable function to check, just check of the required
40-
#' parameters is exists in the definition or not.
41-
#'
42-
#' @details the analysis function should contains only two
43-
#' required parameters with specific name defined:
44-
#'
45-
#' 1. app: a list object that defines the app object itself
46-
#' 2. context: a list object that accept the workflow environment context
47-
#'
48-
#' due to the reason of analysis app function is called via the ``do.call``
49-
#' function from the RENV base environment, so that the parameter value is
50-
#' aligned with the invoke function target strictly, so you can not change
51-
#' the parameter name or the parameter will not be aligned properly when
52-
#' call this analysis app function.
53-
#'
54-
const app_check.delegate = function(analysis) {
55-
const pars = as.list(args(name = analysis));
56-
const verbose = getOption("verbose");
57-
58-
if (as.logical(verbose)) {
59-
str(pars);
60-
}
61-
62-
# pars contains 3 slot value:
63-
#
64-
# 1. empty_name: the function declare info, includes name and the
65-
# possible function value type
66-
# 2. other_name: the function parameter name.
67-
68-
if (length(pars) != 3) {
69-
echo_warning("the analysis application function required 2 parameters!");
70-
return(FALSE);
71-
} else {
72-
return(all(["app", "context"] in names(pars)));
73-
}
74-
}
7531

R/application/validation.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
#' check of the required app slot
3+
#'
4+
const app_check.signature = function(app) {
5+
all(["name", "call"] in names(app));
6+
}
7+
8+
#' Check the function signature of the app function
9+
#'
10+
#' @param analysis a callable function to check, just check of the required
11+
#' parameters is exists in the definition or not.
12+
#'
13+
#' @details the analysis function should contains only two
14+
#' required parameters with specific name defined:
15+
#'
16+
#' 1. app: a list object that defines the app object itself
17+
#' 2. context: a list object that accept the workflow environment context
18+
#'
19+
#' due to the reason of analysis app function is called via the ``do.call``
20+
#' function from the RENV base environment, so that the parameter value is
21+
#' aligned with the invoke function target strictly, so you can not change
22+
#' the parameter name or the parameter will not be aligned properly when
23+
#' call this analysis app function.
24+
#'
25+
const app_check.delegate = function(analysis) {
26+
const pars = as.list(args(name = analysis));
27+
const verbose = getOption("verbose");
28+
29+
if (as.logical(verbose)) {
30+
str(pars);
31+
}
32+
33+
# pars contains 3 slot value:
34+
#
35+
# 1. empty_name: the function declare info, includes name and the
36+
# possible function value type
37+
# 2. other_name: the function parameter name.
38+
39+
if (length(pars) != 3) {
40+
echo_warning("the analysis application function required 2 parameters!");
41+
return(FALSE);
42+
} else {
43+
return(all(["app", "context"] in names(pars)));
44+
}
45+
}

0 commit comments

Comments
 (0)