File: helper-type-sum.R

package info (click to toggle)
r-cran-pillar 1.8.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,840 kB
  • sloc: sh: 13; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (2)
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
as_override_type_sum_asis <- function(x) {
  structure(x, class = "override_type_sum_asis")
}

as_override_type_sum_custom <- function(x) {
  structure(x, class = "override_type_sum_custom")
}

local_override_type_sum <- function(frame = caller_env()) {
  local_methods(
    .frame = frame,
    type_sum.override_type_sum_asis = function(x, ...) {
      I("AsIs")
    },
    # Needed for head()
    `[.override_type_sum_asis` = function(x, ...) {
      as_override_type_sum_asis(NextMethod())
    },
    type_sum.override_type_sum_custom = function(x, ...) {
      structure("VeryLong", class = "override_format_type_sum")
    },
    # Needed for head()
    `[.override_type_sum_custom` = function(x, ...) {
      as_override_type_sum_custom(NextMethod())
    },
    format_type_sum.override_format_type_sum = function(x, ...) {
      "VeryLong"
    }
  )
}