Commit graph

11 commits

Author SHA1 Message Date
Felipe Contreras
ae1336dea5 ruby: add tags helper
Right now it doesn't do much, but it will help for further
reorganization.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-04-02 19:00:49 -03:00
Felipe Contreras
5f49e3421f ruby: new notmuch_rb_object_destroy() helper
The struct used to store the types (rb_data_type_t) contains a "data"
field where we can store whatever we want. I use that field to store a
pointer to the corresponding destroy function. For example
notmuch_rb_database_type contains a pointer to notmuch_database_destroy.

I cast that pointer as a notmuch_status_t (func*)(void *) and call
that function passing the internal object (e.g. notmuch_database_t).

Using the rb_data_type_t data we can call the correct notmuch destroy
function.

Therefore this:

  ret = ((notmuch_status_t (*)(void *)) type->data) (nm_object);

Is effectively the same as this:

  ret = notmuch_database_destroy (database);

The advantage of doing it this way is that much less code is necesary
since each rb_data_type_t has the corresponding destroy function stored
in it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-17 07:25:14 -03:00
Felipe Contreras
9574fb6099 ruby: add all data types
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-17 07:25:14 -03:00
Felipe Contreras
12c36a5e3f ruby: create Data_Wrap_Notmuch_Object helper
This makes the code more maintainable and will help in further patches.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-17 07:25:14 -03:00
Daniel Kahn Gillmor
6a833a6e83 Use https instead of http where possible
Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.
2016-06-05 08:32:17 -03:00
Austin Clements
c4f96d0931 ruby: Add bindings for notmuch_thread_get_messages 2013-02-18 20:23:40 -04:00
Ali Polatel
05dddf883d ruby: be consistent with notmuch's coding style
No functional change, just indentation
2011-10-04 16:43:40 +03:00
Ali Polatel
a08aa32b44 ruby: Rename destroy to destroy!
According to the common Ruby function naming convention, potentially
dangerous functions or functions which operate on the object itself are
suffixed with an exclamation mark. Both of these are true for object
destroying functions.

The following modules are affected:
- Notmuch::Directory
- Notmuch::FileNames
- Notmuch::Query
- Notmuch::Threads
- Notmuch::Thread
- Notmuch::Messages
- Notmuch::Message
- Notmuch::Tags
2011-09-24 15:25:24 +03:00
Ali Polatel
5c9e385591 ruby: Don't barf if an object is destroyed more than once
Raise RuntimeError instead.
Also revise Notmuch::Database a bit.
Add Notmuch::Database.open singleton method.
2010-06-06 09:18:00 +03:00
Ali Polatel
c7893408bb ruby: Kill garbage collection related cruft.
Let the user destroy objects that she wants explicitly.
It's not possible to specify the order objects are garbage collected.
See id:86y6f8v838.fsf@harikalardiyari.ev on ruby-talk for more
information.
2010-06-06 09:17:47 +03:00
Ali Polatel
06bf04500b Initial ruby bindings 2010-06-06 09:16:53 +03:00