R/getBody.R

Defines functions .getBody

.getBody = function(methods){
  body = apply(methods, 1, function(amethod) {
    if(amethod[3] == "public") {
      list(substitute({
        args = as.list(match.call())
        args[[1]] = NULL
        args$object = NULL
        do.call(get(object)[[method]], args)
      },list(method=amethod[[1]], object = amethod[[5]])))
    } else {
      list(substitute({
        args = as.list(match.call())
        args[[1]] = NULL
        args$object = NULL
        get(object)[[method]]
      },list(method=amethod[[1]], object = amethod[[5]])))
    }
  })

  cbind(methods, data.table::data.table(body))
}
RaphaelS1/R62S3 documentation built on April 6, 2022, 4:31 a.m.