print.ThisPathDocumentContext: Printing "ThisPathDocumentContext" Objects

print.ThisPathDocumentContextR Documentation

Printing "ThisPathDocumentContext" Objects

Description

Print a \stringThisPathDocumentContext object.

Usage

## S3 method for class 'ThisPathDocumentContext'
print(x, ..., quote = TRUE)

## S3 method for class 'ThisPathDocumentContext'
format(x, ...)

## S3 method for class 'ThisPathDocumentContext'
as.character(x, ...)

Arguments

x

object of class \stringThisPathDocumentContext.

...

unused.

quote

logical, indicating whether or not strings should be printed with surrounding quotes.

Details

An object of class \stringThisPathDocumentContext is generated upon calling set.sys.path(), wrap.source(), sys.path(), env.path(), or src.path(), and by extension this.path(). It contains information about the path of the executing / / current script.

These objects are not usually user-visible.

Value

for print.ThisPathDocumentContext(), x invisibly.

for format.ThisPathDocumentContext(), a character vector of lines.

for as.character.ThisPathDocumentContext(), a character string of concatenated lines.

Examples

fun <- function (file)
{
    set.sys.path(file, Function = "fun")
    `.@R_PACKAGE_NAME@::document.context`
}


fun()


fun("clipboard")


fun(paste0("https://raw.githubusercontent.com/ArcadeAntics/",
           "this.path/main/tests/sys-path-with-urls.R"))


FILE.R <- tempfile(fileext = ".R"); file.create(FILE.R)

x <- fun(FILE.R)
print(x)
print(x, quote = FALSE)
format(x)
as.character(x)

unlink(FILE.R)

ArcadeAntics/this.path documentation built on July 27, 2024, 12:05 a.m.