Skip to content

Commit

Permalink
prefer inherits() to string-comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlyttle committed Dec 31, 2023
1 parent b88116e commit 0c7fd28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/boxr__internal_dir_comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions R/boxr__internal_get.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 0c7fd28

Please sign in to comment.