unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] ruby: database: make path arg optional
Date: Wed, 22 Mar 2023 20:05:23 -0600	[thread overview]
Message-ID: <20230323020523.135299-3-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20230323020523.135299-1-felipe.contreras@gmail.com>

It can be automatically loaded from the configuration now.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/database.c | 10 +++++++---
 test/T395-ruby.sh        |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index a78d508b..b6de1254 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -59,10 +59,14 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self)
     notmuch_status_t ret;
 
     /* Check arguments */
-    rb_scan_args (argc, argv, "11", &pathv, &hashv);
+    rb_scan_args (argc, argv, "02", &pathv, &hashv);
 
-    SafeStringValue (pathv);
-    path = RSTRING_PTR (pathv);
+    if (!NIL_P (pathv)) {
+	SafeStringValue (pathv);
+	path = RSTRING_PTR (pathv);
+    } else {
+	path = NULL;
+    }
 
     if (!NIL_P (hashv)) {
 	Check_Type (hashv, T_HASH);
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
index e828efed..c066c842 100755
--- a/test/T395-ruby.sh
+++ b/test/T395-ruby.sh
@@ -12,7 +12,7 @@ test_ruby() {
     (
 	cat <<-EOF
 	require 'notmuch'
-	db = Notmuch::Database.new('$MAIL_DIR')
+	db = Notmuch::Database.new()
 	EOF
 	cat
     ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
-- 
2.39.2.13.g1fb56cf030

  parent reply	other threads:[~2023-03-23  2:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  2:05 [PATCH 0/2] ruby: database open improvements Felipe Contreras
2023-03-23  2:05 ` [PATCH 1/2] ruby: use database_open_with_config Felipe Contreras
2023-03-23  2:05 ` Felipe Contreras [this message]
2023-03-31 11:07 ` [PATCH 0/2] ruby: database open improvements David Bremner
2023-03-31 20:42   ` 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=20230323020523.135299-3-felipe.contreras@gmail.com \
    --to=felipe.contreras@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).