# File lib/sup/mbox/ssh-loader.rb, line 12 def initialize uri, username=nil, password=nil, start_offset=nil, usual=true, archived=false, id=nil, labels=[] raise ArgumentError, "not an mbox+ssh uri: #{uri.inspect}" unless uri =~ %^mbox\+ssh://! super uri, start_offset, usual, archived, id @parsed_uri = URI(uri) @username = username @password = password @uri = uri @cur_offset = start_offset @labels = (labels || []).freeze opts = {} opts[:username] = @username if @username opts[:password] = @password if @password @f = SSHFile.new host, filename, opts @loader = Loader.new @f, start_offset, usual, archived, id ## heuristic: use the filename as a label, unless the file ## has a path that probably represents an inbox. end
# File lib/sup/mbox/ssh-loader.rb, line 37 def connect; safely { @f.connect }; end
# File lib/sup/mbox/ssh-loader.rb, line 53 def cur_offset= o; @cur_offset = @loader.cur_offset = o; @dirty = true; end
# File lib/sup/mbox/ssh-loader.rb, line 49 def end_offset safely { @f.size } end
# File lib/sup/mbox/ssh-loader.rb, line 39 def filename; @parsed_uri.path[1..-1] end
# File lib/sup/mbox/ssh-loader.rb, line 38 def host; @parsed_uri.host; end
# File lib/sup/mbox/ssh-loader.rb, line 55 def id= o; @id = @loader.id = o; end
# File lib/sup/mbox/ssh-loader.rb, line 41 def next safely do offset, labels = @loader.next self.cur_offset = @loader.cur_offset # superclass keeps @cur_offset which is used by yaml [offset, (labels + @labels).uniq] # add our labels end end
Generated with the Darkfish Rdoc Generator 2.