FileBlock {teal.reporter} | R Documentation |
FileBlock
Description
FileBlock
manages file-based content in a report,
ensuring appropriate handling of content files.
Super class
teal.reporter::ContentBlock
-> FileBlock
Methods
Public methods
Inherited methods
Method finalize()
Finalize the FileBlock
.
Usage
FileBlock$finalize()
Details
Removes the temporary file created in the constructor.
Method from_list()
Create the FileBlock
from a list.
The list should contain one named field, "basename"
.
Usage
FileBlock$from_list(x, output_dir)
Arguments
x
(
named list
) with one field"basename"
, a name of the file.output_dir
(
character
) with a path to the directory where a file will be copied.
Returns
self
, invisibly.
Examples
FileBlock <- getFromNamespace("FileBlock", "teal.reporter") block <- FileBlock$new() file_path <- tempfile(fileext = ".png") saveRDS(iris, file_path) block$from_list(list(basename = basename(file_path)), dirname(file_path))
Method to_list()
Convert the FileBlock
to a list.
Usage
FileBlock$to_list(output_dir)
Arguments
output_dir
(
character
) with a path to the directory where a file will be copied.
Returns
named list
with a basename
of the file.
Examples
FileBlock <- getFromNamespace("FileBlock", "teal.reporter") block <- FileBlock$new() block$to_list(tempdir())
Method clone()
The objects of this class are cloneable with this method.
Usage
FileBlock$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## ------------------------------------------------
## Method `FileBlock$from_list`
## ------------------------------------------------
FileBlock <- getFromNamespace("FileBlock", "teal.reporter")
block <- FileBlock$new()
file_path <- tempfile(fileext = ".png")
saveRDS(iris, file_path)
block$from_list(list(basename = basename(file_path)), dirname(file_path))
## ------------------------------------------------
## Method `FileBlock$to_list`
## ------------------------------------------------
FileBlock <- getFromNamespace("FileBlock", "teal.reporter")
block <- FileBlock$new()
block$to_list(tempdir())
[Package teal.reporter version 0.4.0 Index]