commit 4a4f70d059f4b529e2474604131c37e4377b313c
parent 3e95c6799666b0e9cd1b202370acd0109923b256
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Mon, 17 Sep 2007 17:30:44 +0000
twiddle expansion changes from Magnus Therning
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@584 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
@@ -14,9 +14,8 @@ class Maildir < Source
## remind me never to use inheritance again.
yaml_properties :uri, :cur_offset, :usual, :archived, :id, :labels
def initialize uri, last_date=nil, usual=true, archived=false, id=nil, labels=[]
- uri = Source.expand_filesystem_uri uri
super uri, last_date, usual, archived, id
- uri = URI(uri)
+ uri = URI(Source.expand_filesystem_uri(uri))
raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -14,20 +14,21 @@ class Loader < Source
case uri_or_fp
when String
- uri_or_fp = Source.expand_filesystem_uri uri_or_fp
- uri = URI(uri_or_fp)
+ uri = URI(Source.expand_filesystem_uri(uri_or_fp))
raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
raise ArgumentError, "mbox uri ('#{uri}') cannot have a host: #{uri.host}" if uri.host
@f = File.open uri.path
+ @path = uri.path
else
@f = uri_or_fp
+ @path = uri_or_fp.path
end
super uri_or_fp, start_offset, usual, archived, id
end
- def file_path; URI(uri).path end
- def is_source_for? uri; super || (URI(Source.expand_filesystem_uri(uri)) == URI(self.uri)); end
+ def file_path; @path end
+ def is_source_for? uri; super || (URI(Source.expand_filesystem_uri(uri)).path == @path); end
def self.suggest_labels_for path
## heuristic: use the filename as a label, unless the file
diff --git a/lib/sup/source.rb b/lib/sup/source.rb
@@ -78,7 +78,7 @@ class Source
def reset!; seek_to! start_offset; end
def == o; o.uri == uri; end
def done?; start_offset.nil? || (self.cur_offset ||= start_offset) >= end_offset; end
- def is_source_for? uri; uri == URI(uri); end
+ def is_source_for? uri; uri == @uri; end
## check should throw a FatalSourceError or an OutOfSyncSourcError
## if it can detect a problem. it is called when the sup starts up