ruby: database: make path arg optional

It can be automatically loaded from the configuration now.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras 2023-03-22 20:05:23 -06:00 committed by David Bremner
parent 83ea220178
commit 4152e1bc20
2 changed files with 8 additions and 4 deletions

View file

@ -59,10 +59,14 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self)
notmuch_status_t ret; notmuch_status_t ret;
/* Check arguments */ /* Check arguments */
rb_scan_args (argc, argv, "11", &pathv, &hashv); rb_scan_args (argc, argv, "02", &pathv, &hashv);
SafeStringValue (pathv); if (!NIL_P (pathv)) {
path = RSTRING_PTR (pathv); SafeStringValue (pathv);
path = RSTRING_PTR (pathv);
} else {
path = NULL;
}
if (!NIL_P (hashv)) { if (!NIL_P (hashv)) {
Check_Type (hashv, T_HASH); Check_Type (hashv, T_HASH);

View file

@ -12,7 +12,7 @@ test_ruby() {
( (
cat <<-EOF cat <<-EOF
require 'notmuch' require 'notmuch'
db = Notmuch::Database.new('$MAIL_DIR') db = Notmuch::Database.new()
EOF EOF
cat cat
) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT