Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support S3 classes #15

Open
mvankessel-EMC opened this issue Apr 12, 2023 · 1 comment
Open

Support S3 classes #15

mvankessel-EMC opened this issue Apr 12, 2023 · 1 comment
Assignees

Comments

@mvankessel-EMC
Copy link
Collaborator

Implement support to be able to detect and investigate S3 classes.

@mvankessel-EMC
Copy link
Collaborator Author

mvankessel-EMC commented Apr 19, 2023

The S3 constructor should be picked up by PaRe, and report this somehow.

# S3: structure
chell <- structure(list(name = "Chell", age = 29), class = "Person")

# S3: class
morgan <- list(name = "Morgan", age = 28)
class(morgan) <- "Person"

The following S3 method definitions should already be picked up:

Overload print:

print.person <- function(x, ...) {
  glue::glue("{x$name} is {x$age} years old.")
}

Create custom generic doStuff:

doStuff <- function(x) {
  UseMethod("doStuff")
}

doStuff.person <- function(x) {
  glue::glue("{x$name} does stuff.")
}

doStuff and doStuff.person should already be picked up seperately.

@mvankessel-EMC mvankessel-EMC self-assigned this Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants