Parent

Class/Module Index [+]

Quicksearch

TMail::FilePort

FilePort

Attributes

filename[R]
ident[R]

Public Class Methods

new( fname ) click to toggle source
# File lib/tmail/port.rb, line 50
def initialize( fname )
  @filename = File.expand_path(fname)
  super()
end

Public Instance Methods

==( other ) click to toggle source
# File lib/tmail/port.rb, line 59
def ==( other )
  other.respond_to?(:filename) and @filename == other.filename
end
Also aliased as: eql?
aopen( &block ) click to toggle source
# File lib/tmail/port.rb, line 90
def aopen( &block )
  File.open(@filename, 'a', &block)
end
copy_to( port ) click to toggle source
# File lib/tmail/port.rb, line 117
def copy_to( port )
  if FilePort === port
    copy_file @filename, port.filename
  else
    File.open(@filename) {|r|
    port.wopen {|w|
        while s = r.sysread(4096)
          w.write << s
        end
    } }
  end
end
Also aliased as: cp
cp( port ) click to toggle source
Alias for: copy_to
eql?( other ) click to toggle source
Alias for: ==
hash() click to toggle source
# File lib/tmail/port.rb, line 65
def hash
  @filename.hash
end
inspect() click to toggle source
# File lib/tmail/port.rb, line 69
def inspect
  "#<#{self.class}:#{@filename}>"
end
move_to( port ) click to toggle source
# File lib/tmail/port.rb, line 106
def move_to( port )
  begin
    File.link @filename, port.filename
  rescue Errno::EXDEV
    copy_to port
  end
  File.unlink @filename
end
Also aliased as: mv
mv( port ) click to toggle source
Alias for: move_to
read_all() click to toggle source
# File lib/tmail/port.rb, line 95
def read_all
  ropen {|f|
      return f.read
  }
end
remove() click to toggle source
# File lib/tmail/port.rb, line 102
def remove
  File.unlink @filename
end
reproducible?() click to toggle source
# File lib/tmail/port.rb, line 73
def reproducible?
  true
end
ropen( &block ) click to toggle source
# File lib/tmail/port.rb, line 82
def ropen( &block )
  File.open(@filename, &block)
end
size() click to toggle source
# File lib/tmail/port.rb, line 77
def size
  File.size @filename
end
wopen( &block ) click to toggle source
# File lib/tmail/port.rb, line 86
def wopen( &block )
  File.open(@filename, 'w', &block)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.