Class: TMail::FilePort

### Home Classes Methods

### In Files

- lib/tmail/port.rb

### Parent

TMail::Port

### Methods

- ::new
- #==
- #aopen
- #copy_to
- #cp
- #eql?
- #hash
- #inspect
- #move_to
- #mv
- #read_all
- #remove
- #reproducible?
- #ropen
- #size
- #wopen

### Files

- CHANGES
- LICENSE
- NOTES
- README
- Rakefile
- MANIFEST
- Makefile
- depend
- Makefile
- COPYING
- README

### Class/Module Index

Quicksearch

- TMail
- TMail::Address
- TMail::AddressGroup
- TMail::AddressHeader
- TMail::Attachment
- TMail::ContentDispositionHeader
- TMail::ContentTransferEncodingHeader
- TMail::ContentTypeHeader
- TMail::DateTimeHeader
- TMail::EncryptedHeader
- TMail::FilePort
- TMail::HeaderField
- TMail::KeywordsHeader
- TMail::Mail
- TMail::MailFlags
- TMail::Maildir
- TMail::MaildirLoader
- TMail::MaildirPort
- TMail::MboxLoader
- TMail::MessageIdHeader
- TMail::MhLoader
- TMail::MhMailbox
- TMail::MhPort
- TMail::MimeVersionHeader
- TMail::Parser
- TMail::Port
- TMail::ReceivedHeader
- TMail::ReferencesHeader
- TMail::ReturnPathHeader
- TMail::SingleAddressHeader
- TMail::StringPort
- TMail::StructuredHeader
- TMail::SyntaxError
- TMail::TMailScanner
- TMail::TextUtils
- TMail::UNIXMbox
- TMail::UnstructuredHeader
- CharDet
- CharDet::Big5DistributionAnalysis
- CharDet::Big5Prober
- CharDet::CharDistributionAnalysis
- CharDet::CharSetGroupProber
- CharDet::CharSetProber
- CharDet::CodingStateMachine
- CharDet::EUCJPContextAnalysis
- CharDet::EUCJPDistributionAnalysis
- CharDet::EUCJPProber
- CharDet::EUCKRDistributionAnalysis
- CharDet::EUCKRProber
- CharDet::EUCTWDistributionAnalysis
- CharDet::EUCTWProber
- CharDet::EscCharSetProber
- CharDet::GB2312DistributionAnalysis
- CharDet::GB2312Prober
- CharDet::HebrewProber
- CharDet::JapaneseContextAnalysis
- CharDet::Latin1Prober
- CharDet::MBCSGroupProber
- CharDet::MultiByteCharSetProber
- CharDet::SBCSGroupProber
- CharDet::SJISContextAnalysis
- CharDet::SJISDistributionAnalysis
- CharDet::SJISProber
- CharDet::SingleByteCharSetProber
- CharDet::UTF8Prober
- CharDet::UniversalDetector

No matching classes.

# 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.