Skip to content

Commit

Permalink
Fixed compatibility bug in glue version 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tzs66405 committed Jan 10, 2025
1 parent f33faa4 commit 64387ba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: Script Based 'NONMEM' Model Development
URL: https://tsahota.github.io/NMproject/, https://github.com/tsahota/NMproject
BugReports: https://github.com/tsahota/NMproject/issues
Version: 0.6.9
Version: 0.6.10
Authors@R: c(
person("Tarj", "Sahota", email = "[email protected]",
role = c("aut", "cre", "cph")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NMproject 0.6.10

* Fixed compatibility bug in glue version `1.8.0`

# NMproject 0.6.9

* Removed timing test
Expand Down
2 changes: 1 addition & 1 deletion R/Vectorize.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Vectorize_nm_list <- function(FUN, vectorize.args = arg.names, SIMPLIFY = FALSE,
m <- args[dovec][[1]][[i]] ## nm_generic
if (is.character(replace_arg_value)) {
args[dovec][[replace_arg]][i] <- stringr::str_glue(replace_arg_value,
.envir = m
.envir = as.environment(m)
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions R/nm_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ glue_text_nm <- function(m, text) {
UseMethod("glue_text_nm")
}
glue_text_nm.nm_generic <- function(m, text) {
stringr::str_glue(text, .envir = m, .na = NULL)
stringr::str_glue(text, .envir = as.environment(m), .na = NULL)
}
glue_text_nm.nm_list <- Vectorize_nm_list(glue_text_nm.nm_generic, SIMPLIFY = TRUE)

Expand All @@ -555,7 +555,7 @@ replace_tag <- function(m, field) {
if (!is.na(m$glue_fields[[field]])) {
## start by resetting to raw
m[[field]] <- glue_text_nm(m, m$glue_fields[[field]])
# m[[field]] <- stringr::str_glue(m$glue_fields[[field]], .envir = m)
# m[[field]] <- stringr::str_glue(m$glue_fields[[field]], .envir = as.environment(m))
m[[field]] <- as.character(m[[field]])
}
m
Expand Down
2 changes: 1 addition & 1 deletion R/nm_tran.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ nm_tran.default <- function(x) {
message("running NMTRAN on ", x)

nm_tran_command <- nm_tran_command()
cmd <- stringr::str_glue(nm_tran_command, .envir = list(ctl_name = basename(x)), .na = NULL)
cmd <- stringr::str_glue(nm_tran_command, .envir = as.environment(list(ctl_name = basename(x))), .na = NULL)
## if non-glue - append the control file name
if (cmd == nm_tran_command) cmd <- paste(cmd, "<", basename(x))

Expand Down

0 comments on commit 64387ba

Please sign in to comment.