From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iMlcOBueuWAT3QAAgWs5BA (envelope-from ) for ; Fri, 04 Jun 2021 05:29:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IN+VMxueuWBBMQAA1q6Kng (envelope-from ) for ; Fri, 04 Jun 2021 03:29:31 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5D42526622 for ; Fri, 4 Jun 2021 05:29:31 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BD55C2B227; Thu, 3 Jun 2021 23:29:16 -0400 (EDT) Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by mail.notmuchmail.org (Postfix) with ESMTPS id C9AB72903E for ; Thu, 3 Jun 2021 23:29:08 -0400 (EDT) Received: by mail-oo1-xc34.google.com with SMTP id 67-20020a4a01460000b0290245b81f6261so1903794oor.6 for ; Thu, 03 Jun 2021 20:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OB87davJR43VmJizE3osxWSltVFeBxGpZPQQFJdvHpE=; b=LaG5VXmbEYYX7IPfy2InO14nsYtYuVaplc/A8P5dihHsiTsuoiAJ9Y/yxzpywv7Ytr 6HcoLhDLj1bSIkZnwk6LaD7aN0+gM0C9UeoinD05sGOwzNQtzskkUuFAUzaeTYGkWtiw rzMx5hPKq6OztL06u1DLsug28FPtphkEAPZeQ2rXtl2x8krtf9XHArv0NEYs9r70VgAH 2sRIzzXVNHGAoFpOlY5QGJEeqYbsW+H6L+7k45993juqvpFZq3j6kcTja5lSkjuFXPn3 L+swIer3b0Xv/eRJUnQSAJorPvHtZxpN/UNLakcrndVoKsBqMYvBhbLQcXs9RzZhrtw4 YRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OB87davJR43VmJizE3osxWSltVFeBxGpZPQQFJdvHpE=; b=E6Qwf9gYCc/rVzGSruGj2XZ6UserTtje/MOkVzqOD4rirvlDxd4io+aMBYZfNEmOgK cM4tXmj4Bvr3ohr5JdiCg9VHURflXdC6xHYT0BY60QTjy3hKrwBDV4520lhS+uyiJPC7 tW7DEa2EaY7zZ+eRZGCJKyL4DrsGR81MNlIfCdW1wCfy8zsmof/C4MEqs1sp7uGSiLjI 33XtxTKSBgOvtwr7Kv3nsUd69bvLpLDkZrk1j8oxZ8cWt9sxK66bkoBVbW2JBSGHATJZ RM2AmTdjgvc4wqAPOsnP83PvJvyMM8nN8/RNztw1Zz5hhZOuJltXdXPcCsNxVXd4wRRA 2fCA== X-Gm-Message-State: AOAM530VYVk0RfYF5jOI2tkyTSC8wKeLYNEix4/i6TSzXjArmD0JhESa 3iuyENTqrZpRTHpccIbE8YXy16yLrg6S9Q== X-Google-Smtp-Source: ABdhPJx/rfnRL5PJmx5gPj7jcDeAnPW0PQsQX3Ztl06eRU4ob5lWpp8GXeefEoTekpplJp0XIZ2o8Q== X-Received: by 2002:a4a:d69a:: with SMTP id i26mr1970162oot.27.1622777347719; Thu, 03 Jun 2021 20:29:07 -0700 (PDT) Received: from localhost (fixed-187-190-78-172.totalplay.net. [187.190.78.172]) by smtp.gmail.com with ESMTPSA id i4sm224601oih.13.2021.06.03.20.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 20:29:07 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Cc: David Bremner , Felipe Contreras Subject: [PATCH 3/3] ruby: make db.config return an enumerator Date: Thu, 3 Jun 2021 22:29:01 -0500 Message-Id: <20210604032901.3815539-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.rc2 In-Reply-To: <20210604032901.3815539-1-felipe.contreras@gmail.com> References: <20210604032901.3815539-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Message-ID-Hash: W4JF2AKANBO4DL4KOCPOVJE3QAPYOEAS X-Message-ID-Hash: W4JF2AKANBO4DL4KOCPOVJE3QAPYOEAS X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622777371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=ofQrYQHpWHZYFRecLUbRXLAl8N+aVHDB/+U2v8wtIW4=; b=bQZNcMYYdhj0mwMAKtDYMLvX3FjvKWJD389GTWQgntHr1Rm1aUwpz23Z80RdgS6IL+gNq2 JiqXY8Bw7yCFlJQPDPgkvwCd2SvXPQHakTwDS+eKUqTcrib+u42qGBazc49Bnn280xC3J3 fzIlE7sJ2puOwz4mVsh9qlNx/nz5mx7GcWSZmvoQ3AVAGhXzAOLdLvNwSkE7qgTuDibfVr 4kh3SjolWYT/N1rEl/mrOC511UOe6b9gJFS1yTMIM3SuZZx91E3b/iviCz2g/2IiLxcpEA 9QRESYqH9aGc5PC1cNmTKRzdCZvQxroDIjiVNwzJ6l2gBNUUzQeGa6+8iRBQZw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622777371; a=rsa-sha256; cv=none; b=se8zFV80lMkI5tDY3iIbVmt/2SlCJ10VqFd4K9EDaY3kunoT8HjqOqjZJRu0sZuXGCF+dT NE2Du5PQ9xTA452lXmYm3WY/xOEIjvYK/igibXgQU1Kr5FLwVdB477Jev4TjHlsyNdczX4 mgxlzCnGb7gcxRTSiCISeig1BLjK/Bv5RQBRpCVEZggpNiFIg1tNoCvwdPvH6IbaDjCMyR Yz05r/uXUzaLbLC14CrkXPK0P8fW2ZH3rMf7+61Jhdy6BXP3ZFVgk3Q0oX17bas2yCZHku TdOuvzoGxPT3jnPTnoc1ZFXoh6qG/G3jzgFMWnAKg2gYorJC8iSxxYBFApTcOA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=LaG5VXmb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=LaG5VXmb; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 5D42526622 X-Spam-Score: -0.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: R7rpId83bQm7 Currently db.config requires a block to work: db.config { |k, v| puts '%s=%s' % [k, v] } If you try to use it without a block you, get an error like: in `config': no block given (LocalJumpError) In Ruby most methods should return an Enumerator if no block is given, like: (1..10).each => # This allows us to do: db.config.to_a db.config.to_h db.config.each { |k, v| ... } And of course what is already possible: db.config { |k, v| ... } Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index 934cbfe8..9316b32d 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -494,6 +494,8 @@ notmuch_rb_database_config (int argc, VALUE *argv, VALUE self) notmuch_config_pairs_t *list; const char *cprefix; + RETURN_ENUMERATOR(self, argc, argv); + Data_Get_Notmuch_Database (self, db); rb_scan_args (argc, argv, "01", &prefix); -- 2.32.0.rc2