File {PaRe} | R Documentation |
Class representing a file containing code.
PaRe::Code
-> File
new()
Initializer method
File$new(repoPath, filePath)
invisible(self)
getFunctions()
Get method to get a list of Function objects
File$getFunctions()
(list)
List of Function objects.
getFunctionTable()
Get method to retrieve the function table.
File$getFunctionTable()
column | data type |
name | character |
lineStart | integer |
lineEnd | numeric |
nArgs | integer |
cycloComp | integer |
getType()
Gets type of file
File$getType()
getFilePath()
Gets relative file path
File$getFilePath()
getBlameTable()
Gets table of git blame
File$getBlameTable()
(tibble)
clone()
The objects of this class are cloneable with this method.
File$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Representations:
Code
,
Function
,
Repository
fetchedRepo <- tryCatch(
{
# Set dir to clone repository to.
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "glue")
# Clone repo
git2r::clone(
url = "https://github.com/tidyverse/glue.git",
local_path = pathToRepo
)
# Create instance of Repository object.
repo <- PaRe::Repository$new(path = pathToRepo)
# Set fetchedRepo to TRUE if all goes well.
TRUE
},
error = function(e) {
# Set fetchedRepo to FALSE if an error is encountered.
FALSE
},
warning = function(w) {
# Set fetchedRepo to FALSE if a warning is encountered.
FALSE
}
)
if (fetchedRepo) {
files <- repo$getRFiles()
files[[1]]
}