Skip to content

Commit

Permalink
put a file object at the top level of every builder
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Nov 7, 2024
1 parent c53ac0d commit 36dde3c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
7 changes: 5 additions & 2 deletions R/class_branch.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ branch_init <- function(
deps = deps,
settings = settings,
cue = cue,
store = store
store = store,
file = file_init()
)
}

Expand All @@ -26,7 +27,8 @@ branch_new <- function(
deps = NULL,
settings = NULL,
cue = NULL,
store = NULL
store = NULL,
file = NULL
) {
out <- new.env(parent = emptyenv(), hash = FALSE)
out$name <- name
Expand All @@ -36,6 +38,7 @@ branch_new <- function(
out$settings <- settings
out$cue <- cue
out$store <- store
out$file <- file
enclass(out, branch_s3_class)
}

Expand Down
2 changes: 2 additions & 0 deletions R/class_builder.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ builder_new <- function(
value = NULL,
metrics = NULL,
store = NULL,
file = NULL,
subpipeline = NULL
) {
out <- new.env(parent = emptyenv(), hash = FALSE)
Expand All @@ -14,6 +15,7 @@ builder_new <- function(
out$value <- value
out$metrics <- metrics
out$store <- store
out$file <- file
out$subpipeline <- subpipeline
enclass(out, builder_s3_class)
}
Expand Down
24 changes: 23 additions & 1 deletion R/class_stem.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
stem_init <- function(
name = NULL,
command = NULL,
seed = NULL,
deps = NULL,
settings = NULL,
cue = NULL
) {
stem_new(
name = name,
command = command,
seed = seed,
deps = deps,
settings = settings,
cue = cue,
store = settings_produce_store(settings),
file = file_init()
)
}

stem_new <- function(
name = NULL,
command = NULL,
seed = NULL,
deps = NULL,
settings = NULL,
cue = NULL,
store = NULL
store = NULL,
file = NULL
) {
out <- new.env(parent = emptyenv(), hash = FALSE)
out$name <- name
Expand All @@ -15,6 +36,7 @@ stem_new <- function(
out$settings <- settings
out$cue <- cue
out$store <- store
out$file <- file
enclass(out, stem_s3_class)
}

Expand Down
5 changes: 2 additions & 3 deletions R/class_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ target_init <- function(
deps <- setdiff(deps, name)
if_any(
is.null(settings$pattern),
stem_new(
stem_init(
name = name,
command = command,
seed = seed,
deps = deps,
settings = settings,
cue = cue,
store = settings_produce_store(settings)
cue = cue
),
pattern_new(
name = name,
Expand Down

0 comments on commit 36dde3c

Please sign in to comment.