File: methods.R

package info (click to toggle)
r-cran-fail 1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 188 kB
  • sloc: sh: 9; makefile: 5
file content (34 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
printObject = function(x, type) {
  info = x$info()
  cat(
    sprintf("%s on path %s", type, info$path),
    sprintf("  %-9s : %s", "extension", info$extension),
    sprintf("  %-9s : %s", "use.cache", info$use.cache),
    sprintf("  %-9s : %s", "simplify", info$simplify),
    sprintf("  %-9s : %i", "items", length(x$ls())),
    sprintf("  %-9s : %i", "cached", length(x$cached())),
    sprintf("  %-9s : %s", "functions", collapse(names(x))),
    sprintf("  %-9s : %s", "methods", collapse(sub("\\.fail$", "", methods(class = "fail")), ", ")),
    sep = "\n"
  )
}

#' @export
print.fail = function(x, ...) {
  printObject(x, "File Abstraction Interface Layer")
}

#' @export
print.sail = function(x, ...) {
  printObject(x, "Source Abstraction Interface Layer")
}

#' @export
as.list.fail = function(x, ...) {
  x$as.list(...)
}

#' @export
as.list.sail = function(x, ...) {
  x$as.list(...)
}