msgthr user+dev discussion/patches/pulls/bugs/help
 help / Atom feed
From: Eric Wong <e@80x24.org>
To: Dimid Duchovny <dimidd@gmail.com>
Cc: msgthr-public@80x24.org
Subject: Re: library usage
Date: Wed, 27 Dec 2017 18:01:57 +0000
Message-ID: <20171227180157.GA10868@starla> (raw)
In-Reply-To: <CANKvuDc2mkxLuh+3+WXWfMXzxK2bShNesrD5xLocGOD1RybbwQ@mail.gmail.com>

Dimid Duchovny <dimidd@gmail.com> wrote:
> Hello,
> 
> I've tried to use the library with a simple example, 2 messages where
> one is a reply to the other:
> require 'msgthr'
> m1 = {id: 1, subject: 's1'}
> m2 = {id: 2, subject: 're: s1'}
> msgthr = Msgthr.new
> msgthr.add 1, nil, m1
> msgthr.add 2, [1], m2
> msgthr.thread!

msgthr.order! { |_| } # noop sort, necessary to flatten internal structures

> msgthr.walk_thread do |level, container, index|
>   msg = container.msg
>   subject = msg ? msg[:subject] : "[missing: <#{container.mid}>]"
>   indent = '  ' * level
>   printf("#{indent} % 3d. %s\n", index, subject)
> end
> 
> Which fails with:
> msgthr.rb:9:in `block in <main>': undefined method `msg' for
> #<Array:0x00007ff404841958> (NoMethodError)
> 
> Am I missing something?

Oops, i guess the documentation is currently wrong in that
order! is not optional.  But a noop block passed to order!
should work for now.

I will make it optional for the next release, and probably
allow the proc as an arg to thread! to simplify the API.

Thanks for the report and sorry for the breakage!

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-27 12:22 Dimid Duchovny
2017-12-27 18:01 ` Eric Wong [this message]
2017-12-27 19:06   ` Dimid Duchovny
2017-12-28  1:43     ` Eric Wong
2017-12-31 13:06       ` Dimid Duchovny
2017-12-31 22:22         ` Eric Wong

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/msgthr/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171227180157.GA10868@starla \
    --to=e@80x24.org \
    --cc=dimidd@gmail.com \
    --cc=msgthr-public@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

msgthr user+dev discussion/patches/pulls/bugs/help

Archives are clonable: git clone --mirror https://80x24.org/msgthr-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.msgthr
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.msgthr

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox