R/pkg_ref_cache_bug_reports_host.R

Defines functions pkg_ref_cache.bug_reports_host.default pkg_ref_cache.bug_reports_host

Documented in pkg_ref_cache.bug_reports_host.default

#' Get the host name of a BugReports url
#'
#' @inheritParams pkg_ref_cache
#' @family package reference cache
#' @return a \code{pkg_ref} object
#' @keywords internal
#' @noRd
pkg_ref_cache.bug_reports_host <- function(x, ...) {
  UseMethod("pkg_ref_cache.bug_reports_host")
}


#' Get the host name of a BugReports url
#'
#' @importFrom urltools domain
#' @return a \code{pkg_ref} object
#' @keywords internal
pkg_ref_cache.bug_reports_host.default <- function(x, ...) {
  if (is.null(x$bug_reports_url)) return(NULL)
  sapply(strsplit(domain(x$bug_reports_url), "\\."), function(dm) dm[length(dm)-1])
}
pharmaR/riskmetric documentation built on April 30, 2024, 5:14 p.m.