Skip to content

Commit c3adb0b

Browse files
committed
Description in glimpse class
1 parent 1ad79eb commit c3adb0b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

R/class_glimpse.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ glimpse_class <- R6::R6Class(
7474
name = names,
7575
type = type,
7676
status = status,
77+
description = rep(NA_real_, length(names)),
7778
seconds = rep(NA_real_, length(names)),
7879
bytes = rep(NA_real_, length(names)),
7980
branches = rep(NA_integer_, length(names))
@@ -87,10 +88,17 @@ glimpse_class <- R6::R6Class(
8788
target_get_type(pipeline_get_target(pipeline, name))
8889
})
8990
status <- rep("none", length(names))
91+
pipeline <- self$pipeline
92+
descriptions <- map_chr(
93+
names,
94+
~pipeline_get_target(pipeline, .x)$settings$description %||%
95+
NA_character_
96+
)
9097
vertices <- data_frame(
9198
name = names,
9299
type = type,
93100
status = status,
101+
description = descriptions,
94102
seconds = rep(NA_real_, length(names)),
95103
bytes = rep(NA_real_, length(names)),
96104
branches = rep(NA_integer_, length(names))

tests/testthat/test-class_glimpse.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tar_test("vertices and edges", {
3838
list(
3939
target_init("x", quote(f(1))),
4040
target_init("y", quote(g(2))),
41-
target_init("z", quote(x + y))
41+
target_init("z", quote(x + y), description = "info")
4242
)
4343
)
4444
vis <- glimpse_init(pipeline, targets_only = FALSE)
@@ -49,6 +49,7 @@ tar_test("vertices and edges", {
4949
name = c("g", "f", "h", "i"),
5050
type = c("function", "function", "object", "object"),
5151
status = rep("none", 4L),
52+
description = NA_character_,
5253
seconds = NA_real_,
5354
bytes = NA_real_,
5455
branches = NA_real_
@@ -57,6 +58,7 @@ tar_test("vertices and edges", {
5758
name = c("x", "y", "z"),
5859
type = rep("stem", 3L),
5960
status = rep("none", 3L),
61+
description = c(rep(NA_character_, 2L), "info"),
6062
seconds = NA_real_,
6163
bytes = NA_real_,
6264
branches = NA_real_

0 commit comments

Comments
 (0)