From 0c7fd281bc1c011d42243d902bcf86a02055ab59 Mon Sep 17 00:00:00 2001 From: Ian Lyttle Date: Sun, 31 Dec 2023 13:55:01 -0600 Subject: [PATCH] prefer inherits() to string-comparison --- R/boxr__internal_dir_comparison.R | 2 +- R/boxr__internal_get.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/boxr__internal_dir_comparison.R b/R/boxr__internal_dir_comparison.R index 4f4d40f4..61d17999 100644 --- a/R/boxr__internal_dir_comparison.R +++ b/R/boxr__internal_dir_comparison.R @@ -211,7 +211,7 @@ box_dir_diff <- function(dir_id = box_getwd(), local_dir = getwd(), load = "up", to_update <- behind <- data.frame() } - if (class(absent) != "data.frame") + if (!inherits(absent, "data.frame")) absent <- data.frame() # The final list to output diff --git a/R/boxr__internal_get.R b/R/boxr__internal_get.R index 66f23310..c6327d81 100644 --- a/R/boxr__internal_get.R +++ b/R/boxr__internal_get.R @@ -1,8 +1,8 @@ handle_file_id <- function(obj) { - if (class(obj) == "boxr_file_reference") { + if (inherits(obj, "boxr_file_reference")) { # If the user's submitted a file reference object, extract the id for them file_id <- obj$id - } else if (class(obj) == "boxr_object_list") { + } else if (inherits(obj, "boxr_object_list")) { # If the user's submitted a list of objects, extract the id from the first, # and emit a message so they know what's up if(length(obj) > 1)