]> git.cworth.org Git - sup/commitdiff
make MBox::Loader#next return nil once EOF is hit
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 17 May 2009 18:36:06 +0000 (11:36 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 17 May 2009 18:36:06 +0000 (11:36 -0700)
Previously it was raising a debugging exception. This is a better
interface for writing unit tests against.

lib/sup/mbox/loader.rb

index 37d253ebf3cfb66902cd5a4b580cbb41aba1da9c..11b071118c3cf5ad692a02d8fbdd6ad10590090b 100644 (file)
@@ -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