From: William Morgan Date: Sun, 17 May 2009 18:36:06 +0000 (-0700) Subject: make MBox::Loader#next return nil once EOF is hit X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=e2aa05a0ceaf03409d5979087d8c50546e53ffe1;p=sup make MBox::Loader#next return nil once EOF is hit Previously it was raising a debugging exception. This is a better interface for writing unit tests against. --- diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb index 37d253e..11b0711 100644 --- a/lib/sup/mbox/loader.rb +++ b/lib/sup/mbox/loader.rb @@ -128,7 +128,7 @@ class Loader < Source ## 2. at the beginning of an mbox separator (in all other ## cases). - l = @f.gets or raise "next while at EOF" + l = @f.gets or return nil if l =~ /^\s*$/ # case 1 returned_offset = @f.tell @f.gets # now we're at a BREAK_RE, so skip past it