List the methods registered on an S7 generic, or the methods registered
for a given class across all S7 generics defined in attached packages.
Arguments
- generic
An S7 generic.
- class
A class specification (anything accepted by
as_class()). When supplied, every S7 generic in every attached package is searched for methods with this class in their signature.
Value
A data frame with one row per matching method and columns:
generic: the generic's name.package: the package the generic is defined in, orNAfor generics found in the global environment (or whengenericis supplied directly).signature: a list column ofS7_signatureobjects describing the dispatch signature.format()them for a human-readable description.
Examples
Foo <- new_class("Foo", package = NULL)
Bar <- new_class("Bar", package = NULL)
my_gen <- new_generic("my_gen", "x")
method(my_gen, Foo) <- function(x) "foo"
method(my_gen, Bar) <- function(x) "bar"
S7_methods(generic = my_gen)
#> generic package signature
#> 1 my_gen <NA> <Foo>
#> 2 my_gen <NA> <Bar>
S7_methods(class = Foo)
#> [1] generic package signature
#> <0 rows> (or 0-length row.names)