vt_dynamic_referencer | R Documentation |
Manage dynamic refrerencing
Manage dynamic refrerencing
The job of the dynamic referencer is to aggregate the references that exist from requirements, test cases, test code and in the validation report and update them accordingly. This helps with the painful cases where a new reference may be added between existing numbering and all subsequent references need to be updated
The user should not need to use this object directly, it will be called upon on rendering of the contents in the validation report.
By default, the expected indicator for a reference is "##", though this can be changed. A reference starts with the indicator (##) and can then be any contiguous (no white spaces or special characters) alphanumeric sequence, or include an underscore or dash. ie. ##req:THISIS_A-reference1234 is valid for the entire string, but ##req:THISIS_A-reference.12345 is a dynamic reference up to the ".".
The method 'scrape_references' takes in a vector of strings, and an indicator whether the input file text is a requirement ('req'), test case or test code ('tc'). This allows numbering to increase independently for each. However, every reference must be unique. ie. ##reference whether it shows up in a test case or requirement will be the same reference.
The method 'reference_insertion' takes a vector of strings and replaces references with their numeric values.
scrape_references()
collect references from text.
vt_dynamic_referencer$scrape_references(text)
text
character vector to collect references from.
type
type of file being converted; a requirement ('req'), test case or test code ('tc')
ref <- vt_dynamic_referencer$new() ref$list_references() ref$scrape_references("##req:new_reference") ref$list_references()
reference_insertion()
replace references in text with values
vt_dynamic_referencer$reference_insertion(text)
text
character vector to be inserting references into
ref <- vt_dynamic_referencer$new() ref$list_references() ref$scrape_references("##new_reference") ref$list_references() ref$reference_insertion("This is my ##new_reference")
list_references()
list references available and their value
vt_dynamic_referencer$list_references()
ref <- vt_dynamic_referencer$new() ref$list_references() ref$scrape_references("##new_reference") ref$list_references()
new()
create a new dynamic reference object
vt_dynamic_referencer$new( reference_indicator = "##", type = c("number", "letter") )
reference_indicator
character vector that indicates the start of the dynamic references. defaults to "##type:reference"
type
"number" (arabic) or "letter" (latin uppercase) to use for counters
a new vt_dynamic_reference
object
clone()
The objects of this class are cloneable with this method.
vt_dynamic_referencer$clone(deep = FALSE)
deep
Whether to make a deep clone.
reference <- vt_dynamic_referencer$new()
reference
## ------------------------------------------------
## Method `vt_dynamic_referencer$scrape_references`
## ------------------------------------------------
ref <- vt_dynamic_referencer$new()
ref$list_references()
ref$scrape_references("##req:new_reference")
ref$list_references()
## ------------------------------------------------
## Method `vt_dynamic_referencer$reference_insertion`
## ------------------------------------------------
ref <- vt_dynamic_referencer$new()
ref$list_references()
ref$scrape_references("##new_reference")
ref$list_references()
ref$reference_insertion("This is my ##new_reference")
## ------------------------------------------------
## Method `vt_dynamic_referencer$list_references`
## ------------------------------------------------
ref <- vt_dynamic_referencer$new()
ref$list_references()
ref$scrape_references("##new_reference")
ref$list_references()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.