commit 456d372afbfb480f28061fea7fe70a2bf41dbca4
parent 35436de2f4b9e49d47b9c5a9ad0d0d23b5c2cbec
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Fri, 1 Jan 2010 14:14:00 -0800
ruby 1.9: expect nil start_offset when an MBox::Loader is first created
Various callers (including sup-add) passed a nil start_offset. Through a
convoluted path probably involving the fact that nil.to_i == 0, this did the
right thing on Ruby 1.8. It crashes on 1.9, so change initialize to expect a
nil offset and replace it with 0.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -12,7 +12,7 @@ class Loader < Source
attr_reader :labels
## uri_or_fp is horrific. need to refactor.
- def initialize uri_or_fp, start_offset=0, usual=true, archived=false, id=nil, labels=nil
+ def initialize uri_or_fp, start_offset=nil, usual=true, archived=false, id=nil, labels=nil
@mutex = Mutex.new
@labels = Set.new((labels || []) - LabelManager::RESERVED_LABELS)
@@ -29,6 +29,7 @@ class Loader < Source
@path = uri_or_fp.path
end
+ start_offset ||= 0
super uri_or_fp, start_offset, usual, archived, id
end