about summary refs log tree commit homepage
path: root/lib/msgthr/container.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-12-28 01:04:01 +0000
committerEric Wong <e@80x24.org>2017-12-28 01:29:51 +0000
commitd06d8c221be5b82d00da821323fb6d1889e58105 (patch)
tree04d1078b21632f3d212736d207a3a6fd069578b5 /lib/msgthr/container.rb
parentffd573d913751ee5f6fee44ab7f2f9295f3c0495 (diff)
downloadmsgthr-d06d8c221be5b82d00da821323fb6d1889e58105.tar.gz
This fixes our API to match the documentation in making
Msgthr#order! optional.  Furthermore, the block previously
passed to Msgthr#order! may now be passed to Msgthr#thread!
instead.

We accomplish this by tracking internal state explicitly, so a
Msgthr::StateError exception will be raised when methods are
called in an unsupported order.  This internal state is reset
with Msgthr#clear.

For users who truly do not care about ordering, Msgthr#walk_thread
may be called immediately after the last call to Msgthr#add.

Thanks to Dimid Duchovny for the feedback which led to this:
https://80x24.org/msgthr-public/CANKvuDc2mkxLuh+3+WXWfMXzxK2bShNesrD5xLocGOD1RybbwQ@mail.gmail.com/
Diffstat (limited to 'lib/msgthr/container.rb')
-rw-r--r--lib/msgthr/container.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/msgthr/container.rb b/lib/msgthr/container.rb
index e51507c..fbff719 100644
--- a/lib/msgthr/container.rb
+++ b/lib/msgthr/container.rb
@@ -1,9 +1,9 @@
 # Copyright (C) 2016 all contributors <msgthr-public@80x24.org>
 # License: GPL-2.0+ <https://www.gnu.org/licenses/gpl-2.0.txt>
 
-# An internal container class, this is exposed for Msgthr#order!
-# and Msgthr#walk_thread APIs.  They should should not be initialized
-# in your own code.
+# An internal container class, this is exposed for Msgthr#thread!
+# Msgthr#order! and Msgthr#walk_thread APIs through block parameters.
+# They should should not be initialized in your own code.
 #
 # One container object will exist for every message you call Msgthr#add! on,
 # so there can potentially be many of these objects for large sets of