From 3183e83cc52afdcf8e84bb490397be0246e81db7 Mon Sep 17 00:00:00 2001 From: mihaiconstantin Date: Sun, 30 Apr 2023 21:12:54 +0200 Subject: [PATCH] Refactor: simplify `.execute` in `ProgressTrackingContext` --- R/ProgressTrackingContext.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/ProgressTrackingContext.R b/R/ProgressTrackingContext.R index 6ba5450..9096759 100644 --- a/R/ProgressTrackingContext.R +++ b/R/ProgressTrackingContext.R @@ -225,11 +225,11 @@ ProgressTrackingContext <- R6::R6Class("ProgressTrackingContext", unlink(log) }) - # Decorate task function and save it as `task` (i.e., for readability). - task <- private$.decorate(task = fun, log = log) + # Decorate the task function. + fun <- private$.decorate(task = fun, log = log) - # Substitute `fun` with `task` (i.e., for readability) and evaluate. - eval(substituteDirect(operation, list(fun = task))) + # Evaluate the operation now referencing the decorated task. + eval(operation) # Show the progress bar and block the main process. private$.show_progress(total = length(x), log = log)