From db8bb9b749f8dec0f6859b324a1fe53d05b9a8e8 Mon Sep 17 00:00:00 2001 From: Jay Qi Date: Wed, 12 Sep 2018 18:47:08 -0500 Subject: [PATCH] Changed several methods to return invisible(self) for chaining --- R/module_custom_function.R | 8 ++++---- R/module_package_function.R | 6 +++--- R/workflow_dag.R | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/module_custom_function.R b/R/module_custom_function.R index 56574c0..3f356df 100644 --- a/R/module_custom_function.R +++ b/R/module_custom_function.R @@ -117,7 +117,7 @@ CustomFunctionModule <- R6::R6Class("CustomFunctionModule" private$name <- name private$fun <- fun - self$errorCheck() + return(self$errorCheck()) } , clearOutputCache = function() { @@ -128,7 +128,7 @@ CustomFunctionModule <- R6::R6Class("CustomFunctionModule" private$futurePromise <- NULL - return(invisible(NULL)) + return(invisible(self)) } , errorCheck = function(executionCheck = FALSE @@ -146,7 +146,7 @@ CustomFunctionModule <- R6::R6Class("CustomFunctionModule" UpDraftSettings$errorLogger("fun must be a reference to a function") } - return(invisible(NULL)) + return(invisible(self)) } , getFuncObj = function() { @@ -193,7 +193,7 @@ CustomFunctionModule <- R6::R6Class("CustomFunctionModule" , args = args , funcName = self$getName()) - return(NULL) + return(invisible(NULL)) } ) diff --git a/R/module_package_function.R b/R/module_package_function.R index 5fe0bb0..7a2446e 100644 --- a/R/module_package_function.R +++ b/R/module_package_function.R @@ -137,7 +137,7 @@ PackageFunctionModule <- R6::R6Class("PackageFunctionModule" private$assignedProcesses <- assignedProcesses } - self$errorCheck() + return(self$errorCheck()) } , clearOutputCache = function() { @@ -148,7 +148,7 @@ PackageFunctionModule <- R6::R6Class("PackageFunctionModule" private$futurePromise <- NULL - return(invisible(NULL)) + return(invisible(self)) } , errorCheck = function(executionCheck = FALSE @@ -170,7 +170,7 @@ PackageFunctionModule <- R6::R6Class("PackageFunctionModule" UpDraftSettings$errorLogger("assignedProcesses must be a single whole number numeric") } - return(NULL) + return(invisible(self)) } , getName = function() { diff --git a/R/workflow_dag.R b/R/workflow_dag.R index 9a4cdfa..44be0dc 100644 --- a/R/workflow_dag.R +++ b/R/workflow_dag.R @@ -196,7 +196,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" private$connections <- list() private$graph <- igraph::graph.empty() - self$errorCheck() + return(self$errorCheck()) } , addConnections = function(connections) { @@ -225,7 +225,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" }) } - return(invisible(NULL)) + return(invisible(self)) } , addModules = function(modules) { @@ -251,7 +251,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" }) } - return(invisible(NULL)) + return(invisible(self)) } , errorCheck = function(executionCheck = FALSE @@ -301,7 +301,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" } } - return(NULL) + return(invisible(self)) } , getWorkflowInputs = function() { @@ -440,7 +440,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" private$connections[connection] <- NULL - return(NULL) + return(invisible(self)) } , removeModule = function(module) { @@ -461,7 +461,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" , names(igraph::E(private$graph))) private$connections[connectionsLost] <- NULL - return(NULL) + return(invisible(self)) } , save = function(filename) { @@ -482,7 +482,7 @@ DAGWorkflow <- R6::R6Class("DAGWorkflow" write(jsonlite::toJSON(workflowData), filename) - return(NULL) + return(invisible(self)) } , visualize = function() {