Catapult Class for Consistent Printing
catapult.Rd
Creates an object of class "catapult"
with a built-in title string used for printing.
Arguments
- object
Object to be converted to
"catapult"
class.- lead
a
character
string giving the title to be printed.- revert
logical
indicating whether the"revert"
attribute should be set toTRUE
orFALSE
. By default, whenFALSE
, the corresponding print methodprint.catapult()
will invoke further print methods for the underlying inheritedobject
; ifTRUE
,print.catapult()
will return to the calling function after printinglead
.- ...
additional named arguments to be forwarded to print methods of classes inherited from
object
, for example as required for formatting and printing adata frame
.- x
an object used to select a method.
Examples
catapult()
#> ___________
#> Catapult: -
#>
#> logical(0)
(cpt <- catapult("x", lead = "Lorem ipsum dolor sit amet"))
#> _____________________________
#> Lorem ipsum dolor sit amet: -
#>
#> [1] "x"
.class2(cpt)
#> [1] "catapult" "character"
attr(cpt, "revert")
#> [1] FALSE
(cpt <- catapult("x", lead = "Lorem ipsum dolor sit amet", TRUE))
#> _____________________________
#> Lorem ipsum dolor sit amet: -
#>
.class2(cpt)
#> [1] "catapult" "character"
attr(cpt, "revert")
#> [1] TRUE
rm(cpt)