[PATCH 2/3] ruby: tags: return string array directly

Subject: [PATCH 2/3] ruby: tags: return string array directly

Date: Wed, 22 Mar 2023 17:43:45 -0600

To: notmuch@notmuchmail.org

Cc: arcnmx

From: Felipe Contreras


Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/tags.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bindings/ruby/tags.c b/bindings/ruby/tags.c
index cc6ea59e..cad17d4c 100644
--- a/bindings/ruby/tags.c
+++ b/bindings/ruby/tags.c
@@ -23,7 +23,12 @@
 VALUE
 notmuch_rb_tags_get (notmuch_tags_t *tags)
 {
-    return Data_Wrap_Notmuch_Object (notmuch_rb_cTags, &notmuch_rb_tags_type, tags);
+    VALUE rb_array = rb_ary_new();
+    for (; notmuch_tags_valid (tags); notmuch_tags_move_to_next (tags)) {
+	const char *tag = notmuch_tags_get (tags);
+	rb_ary_push (rb_array, rb_str_new2 (tag));
+    }
+    return rb_array;
 }
 
 /*
-- 
2.39.2.13.g1fb56cf030

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

Thread: