aboutsummaryrefslogtreecommitdiff
path: root/bindings/ruby
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2023-03-27 15:59:40 -0600
committerDavid Bremner <david@tethera.net>2023-04-12 07:05:23 -0300
commit777b02a7d7b922bcae08af1c16e475051ec7d8f3 (patch)
tree25308f0978cf513af0310ed1e973c33e7ba4afa7 /bindings/ruby
parenta554690d6af0ac8cb55166a20efd0f449abde389 (diff)
ruby: add filenames helper
Right now it doesn't do much, but it will help for further reorganization. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'bindings/ruby')
-rw-r--r--bindings/ruby/defs.h3
-rw-r--r--bindings/ruby/directory.c4
-rw-r--r--bindings/ruby/filenames.c6
-rw-r--r--bindings/ruby/message.c2
4 files changed, 12 insertions, 3 deletions
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 027408a1..97aea25d 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -225,6 +225,9 @@ notmuch_rb_directory_get_child_directories (VALUE self);
/* filenames.c */
VALUE
+notmuch_rb_filenames_get (notmuch_filenames_t *fnames);
+
+VALUE
notmuch_rb_filenames_destroy (VALUE self);
VALUE
diff --git a/bindings/ruby/directory.c b/bindings/ruby/directory.c
index 910f0a99..f267d82f 100644
--- a/bindings/ruby/directory.c
+++ b/bindings/ruby/directory.c
@@ -87,7 +87,7 @@ notmuch_rb_directory_get_child_files (VALUE self)
fnames = notmuch_directory_get_child_files (dir);
- return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
+ return notmuch_rb_filenames_get (fnames);
}
/*
@@ -106,5 +106,5 @@ notmuch_rb_directory_get_child_directories (VALUE self)
fnames = notmuch_directory_get_child_directories (dir);
- return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
+ return notmuch_rb_filenames_get (fnames);
}
diff --git a/bindings/ruby/filenames.c b/bindings/ruby/filenames.c
index 0dec1952..17873393 100644
--- a/bindings/ruby/filenames.c
+++ b/bindings/ruby/filenames.c
@@ -20,6 +20,12 @@
#include "defs.h"
+VALUE
+notmuch_rb_filenames_get (notmuch_filenames_t *fnames)
+{
+ return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
+}
+
/*
* call-seq: FILENAMES.destroy! => nil
*
diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c
index 81085f75..13c182f6 100644
--- a/bindings/ruby/message.c
+++ b/bindings/ruby/message.c
@@ -120,7 +120,7 @@ notmuch_rb_message_get_filenames (VALUE self)
fnames = notmuch_message_get_filenames (message);
- return Data_Wrap_Notmuch_Object (notmuch_rb_cFileNames, &notmuch_rb_filenames_type, fnames);
+ return notmuch_rb_filenames_get (fnames);
}
/*