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
=> #<Enumerator: ...>
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 <[email protected]>
---
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
_______________________________________________
notmuch mailing list -- [email protected]
To unsubscribe send an email to [email protected]