Re: [PATCH 2/3] ruby: add directory.delete

Subject: Re: [PATCH 2/3] ruby: add directory.delete

Date: Mon, 29 May 2023 08:24:18 -0300

To: Felipe Contreras, notmuch@notmuchmail.org

Cc:

From: David Bremner


Felipe Contreras <felipe.contreras@gmail.com> writes:

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  bindings/ruby/defs.h      |  3 +++
>  bindings/ruby/directory.c | 19 +++++++++++++++++++
>  bindings/ruby/init.c      |  1 +
>  3 files changed, 23 insertions(+)
>
> diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
> index c4943681..3ef228b7 100644
> --- a/bindings/ruby/defs.h
> +++ b/bindings/ruby/defs.h
> @@ -227,6 +227,9 @@ notmuch_rb_directory_get_child_files (VALUE self);
>  VALUE
>  notmuch_rb_directory_get_child_directories (VALUE self);
>  
> +VALUE
> +notmuch_rb_directory_delete (VALUE self);
> +
>  /* filenames.c */
>  VALUE
>  notmuch_rb_filenames_destroy (VALUE self);
> diff --git a/bindings/ruby/directory.c b/bindings/ruby/directory.c
> index 910f0a99..2fb22c70 100644
> --- a/bindings/ruby/directory.c
> +++ b/bindings/ruby/directory.c
> @@ -108,3 +108,22 @@ notmuch_rb_directory_get_child_directories (VALUE self)
>  
>      return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
>  }
> +
> +/*
> + * call-seq: DIR.delete => nil
> + *
> + * Delete directory from the database.
> + */
> +VALUE
> +notmuch_rb_directory_delete (VALUE self)
> +{
> +    notmuch_directory_t *dir;
> +    notmuch_status_t ret;
> +
> +    Data_Get_Notmuch_Directory (self, dir);
> +
> +    ret = notmuch_directory_delete (dir);
> +    notmuch_rb_status_raise (ret);
> +
> +    return Qnil;
> +}

I don't mind if tests come in later patches or in the patch that
introduces new API, but please add a test every time the ruby bindings
API grows.

d
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: