ruby: add tags helper

Right now it doesn't do much, but it will help for further
reorganization.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras 2023-03-22 17:43:44 -06:00 committed by David Bremner
parent 6273966d0b
commit ae1336dea5
6 changed files with 13 additions and 4 deletions

View file

@ -412,7 +412,7 @@ notmuch_rb_database_get_all_tags (VALUE self)
rb_raise (notmuch_rb_eBaseError, "%s", msg);
}
return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
return notmuch_rb_tags_get (tags);
}
/*

View file

@ -369,6 +369,9 @@ VALUE
notmuch_rb_message_thaw (VALUE self);
/* tags.c */
VALUE
notmuch_rb_tags_get (notmuch_tags_t *tags);
VALUE
notmuch_rb_tags_destroy (VALUE self);

View file

@ -221,7 +221,7 @@ notmuch_rb_message_get_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
return notmuch_rb_tags_get (tags);
}
/*

View file

@ -71,5 +71,5 @@ notmuch_rb_messages_collect_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
return notmuch_rb_tags_get (tags);
}

View file

@ -20,6 +20,12 @@
#include "defs.h"
VALUE
notmuch_rb_tags_get (notmuch_tags_t *tags)
{
return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
}
/*
* call-seq: TAGS.destroy! => nil
*

View file

@ -204,5 +204,5 @@ notmuch_rb_thread_get_tags (VALUE self)
if (!tags)
rb_raise (notmuch_rb_eMemoryError, "Out of memory");
return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
return notmuch_rb_tags_get (tags);
}