Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method("!=",enum)
S3method("$",enum)
S3method("$",interface_object)
S3method("$<-",enum)
Expand Down
17 changes: 17 additions & 0 deletions R/enum.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ print.enum <- function(x, ...) {
}
}

#' Non equality comparison for enum objects
#'
#' @description
#' Compares two enum objects or an enum object with a character value and returns TRUE if they are different.
#'
#' @param e1 First enum object
#' @param e2 Second enum object or a character value
#' @return Logical value indicating whether the two objects are different
#' @export
`!=.enum` <- function(e1, e2) {
if (inherits(e2, "enum")) {
e1$value != e2$value
} else {
e1$value != e2
}
}

#' Get value from enum object
#'
#' @description
Expand Down
19 changes: 19 additions & 0 deletions man/not-equals-.enum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.