From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CAEBD1F404; Wed, 27 Dec 2017 18:01:57 +0000 (UTC) Date: Wed, 27 Dec 2017 18:01:57 +0000 From: Eric Wong To: Dimid Duchovny Cc: msgthr-public@80x24.org Subject: Re: library usage Message-ID: <20171227180157.GA10868@starla> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Dimid Duchovny 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
': undefined method `msg' for > # (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!