Skip to content

Commit

Permalink
Rename to .ark.register_method()
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed Oct 17, 2024
1 parent 5ab5b9d commit 07d365e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/ark/src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl ArkGenerics {

pub fn register_method(&self, class: &str, method: RObject) -> anyhow::Result<()> {
let generic_name: &str = self.into();
RFunction::new("", ".ark.register_ark_method")
RFunction::new("", ".ark.register_method")
.add(RObject::try_from(generic_name)?)
.add(RObject::try_from(class)?)
.add(method)
Expand Down
2 changes: 1 addition & 1 deletion crates/ark/src/modules/positron/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ lockEnvironment(ark_methods_table, TRUE)
#' @param class Class name as a character
#' @param method A method to be registered. Should be a call object.
#' @export
.ark.register_ark_method <- function(generic, class, method) {
.ark.register_method <- function(generic, class, method) {
stopifnot(
is_string(generic),
generic %in% names(ark_methods_table),
Expand Down
8 changes: 4 additions & 4 deletions crates/ark/src/variables/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1377,20 +1377,20 @@ mod tests {
// Register the display value method
harp::parse_eval_global(
r#"
.ark.register_ark_method("ark_positron_variable_display_value", "foo", function(x, width) {
.ark.register_method("ark_positron_variable_display_value", "foo", function(x, width) {
# We return a large string and make sure it gets truncated.
paste0(rep("a", length.out = 2*width), collapse="")
})
.ark.register_ark_method("ark_positron_variable_display_type", "foo", function(x, include_length) {
.ark.register_method("ark_positron_variable_display_type", "foo", function(x, include_length) {
paste0("foo (", length(x), ")")
})
.ark.register_ark_method("ark_positron_variable_has_children", "foo", function(x) {
.ark.register_method("ark_positron_variable_has_children", "foo", function(x) {
FALSE
})
.ark.register_ark_method("ark_positron_variable_kind", "foo", function(x) {
.ark.register_method("ark_positron_variable_kind", "foo", function(x) {
"other"
})
Expand Down

0 comments on commit 07d365e

Please sign in to comment.