r-lib / sloop

S language OOP ⛵️

Home Page:https://sloop.r-lib.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List all methods

hadley opened this issue · comments

Something like:

library(tidyverse)

methods("format") %>% 
  attr(., "info") %>% 
  as_tibble() %>% 
  rownames_to_column("method") %>% 
  mutate(class = stringr::str_split_fixed(method, "\\.", 2)[, 2]) %>% 
  select(generic, class, visible, from)

May want to consider implementing methods() from scratch — will help understand precise semantics of method lookup.