From 28f7ed14dc65a5c0f9cd343d32431a0273c06159 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.fr>
Date: Fri, 30 Apr 2021 10:00:02 +0200
Subject: [PATCH] feat(Utils): add a .IndexOutputs function to index
 OutputsModel objects - to be replaced by '[.OutputsModel' in airGR 2.0 Refs #
 122

---
 R/Utils.R | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/R/Utils.R b/R/Utils.R
index 6aa1f33f..0b9e988d 100644
--- a/R/Utils.R
+++ b/R/Utils.R
@@ -218,16 +218,17 @@
   res
 }
 
+.IndexOutputsModel <- function(x, i) {
 # '[.OutputsModel' <- function(x, i) {
-#   if (!inherits(x, "OutputsModel")) {
-#     stop("'x' must be of class 'OutputsModel'")
-#   }
-#   if (is.factor(i)) {
-#     i <- as.character(i)
-#   }
-#   if (is.numeric(i)) {
-#     .ExtractOutputsModel(x, i)
-#   } else {
-#     NextMethod()
-#   }
-# }
+  if (!inherits(x, "OutputsModel")) {
+    stop("'x' must be of class 'OutputsModel'")
+  }
+  if (is.factor(i)) {
+    i <- as.character(i)
+  }
+  if (is.numeric(i)) {
+    .ExtractOutputsModel(x, i)
+  } else {
+    NextMethod()
+  }
+}
-- 
GitLab