Skip to content

Commit

Permalink
give the pattern a store
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Nov 7, 2024
1 parent faa43ce commit eb70a6d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
25 changes: 24 additions & 1 deletion R/class_pattern.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
pattern_init <- function(
name = NULL,
command = NULL,
seed = NULL,
deps = NULL,
settings = NULL,
cue = NULL
) {
pattern_new(
name = name,
command = command,
seed = seed,
deps = deps,
settings = settings,
cue = cue,
store = settings_produce_store(settings),
patternview = patternview_init()
)
}

pattern_new <- function(
name = NULL,
command = NULL,
seed = NULL,
deps = NULL,
settings = NULL,
cue = NULL,
store = NULL,
patternview = NULL
) {
out <- new.env(parent = emptyenv(), hash = FALSE)
Expand All @@ -14,6 +35,7 @@ pattern_new <- function(
out$deps <- deps
out$settings <- settings
out$cue <- cue
out$store <- store
out$patternview <- patternview
enclass(out, pattern_s3_class)
}
Expand Down Expand Up @@ -142,6 +164,7 @@ target_validate.tar_pattern <- function(target) {
tar_assert_scalar(target$seed)
tar_assert_none_na(target$seed)
tar_assert_chr(target$deps)
store_validate(target$store)
if (!is.null(target$junction)) {
junction_validate(target$junction)
}
Expand Down Expand Up @@ -229,7 +252,7 @@ pattern_set_branches <- function(target, pipeline) {
deps_parent <- target$deps
settings <- target$settings
cue <- target$cue
store <- settings_produce_store(settings)
store <- target$store
specs <- junction_transpose(target$junction)
for (spec in specs) {
branch <- branch_init(
Expand Down
5 changes: 2 additions & 3 deletions R/class_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ target_init <- function(
settings = settings,
cue = cue
),
pattern_new(
pattern_init(
name = name,
command = command,
seed = seed,
deps = deps,
settings = settings,
cue = cue,
patternview = patternview_init()
cue = cue
)
)
}
Expand Down

0 comments on commit eb70a6d

Please sign in to comment.