-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store organisation defaults in an organisation class
- Loading branch information
Showing
10 changed files
with
184 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#' @title The organisation R6 class | ||
#' @description A class with the organisation defaults | ||
#' @export | ||
#' @importFrom R6 R6Class | ||
#' @family class | ||
organisation <- R6Class( | ||
"organisation", | ||
public = list( | ||
#' @description Initialize a new `organisation` object. | ||
initialize = function() { | ||
invisible(self) | ||
}, | ||
#' @description Print the `organisation` object. | ||
#' @param ... currently ignored. | ||
print = function(...) { | ||
dots <- list(...) | ||
c("rightsholder: %s", "funder: %s", "email domain settings") |> | ||
paste(collapse = "\n") |> | ||
sprintf(self$get_rightsholder, self$get_funder) |> | ||
cat() | ||
org <- self$get_organisation | ||
for (domain in names(org)) { | ||
cat( | ||
"\n-", domain, "\n mandatory ORCID iD"[org[[domain]]$orcid], | ||
"\n affiliations", | ||
sprintf( | ||
"\n %s: %s", names(org[[domain]]$affiliation), | ||
org[[domain]]$affiliation | ||
) | ||
) | ||
} | ||
return(invisible(NULL)) | ||
} | ||
), | ||
active = list( | ||
#' @field get_funder The default funder. | ||
get_funder = function() { | ||
private$funder | ||
}, | ||
#' @field get_organisation The organisation requirements. | ||
get_organisation = function() { | ||
private$organisation | ||
}, | ||
#' @field get_rightsholder The default rightsholder. | ||
get_rightsholder = function() { | ||
private$rightsholder | ||
} | ||
), | ||
private = list( | ||
funder = "Research Institute for Nature and Forest (INBO)", | ||
organisation = list( | ||
"inbo.be" = list( | ||
affiliation = c( | ||
en = "Research Institute for Nature and Forest (INBO)", | ||
nl = "Instituut voor Natuur- en Bosonderzoek (INBO)", | ||
fr = "Institut de Recherche sur la Nature et les For\u00eats (INBO)", | ||
de = "Institut f\u00fcr Natur- und Waldforschung (INBO)" | ||
), | ||
orcid = TRUE | ||
) | ||
), | ||
rightsholder = "Research Institute for Nature and Forest (INBO)" | ||
) | ||
) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters