unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Cc: arcnmx <arcnmx@gmail.com>
Subject: [PATCH 2/3] ruby: tags: return string array directly
Date: Wed, 22 Mar 2023 17:43:45 -0600	[thread overview]
Message-ID: <20230322234346.70537-3-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20230322234346.70537-1-felipe.contreras@gmail.com>

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

  parent reply	other threads:[~2023-03-22 23:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 23:43 [PATCH 0/3] ruby: get rid of Tags object Felipe Contreras
2023-03-22 23:43 ` [PATCH 1/3] ruby: add tags helper Felipe Contreras
2023-03-22 23:43 ` Felipe Contreras [this message]
2023-03-22 23:43 ` [PATCH 3/3] ruby: remove Tags object Felipe Contreras
2023-04-02 22:18 ` [PATCH 0/3] ruby: get rid of " David Bremner
2023-04-02 23:06   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322234346.70537-3-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=arcnmx@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).