Class: TMail::StringPort

### Home Classes Methods

### In Files

- lib/tmail/port.rb

### Parent

TMail::Port

### Methods

- ::new
- #==
- #aopen
- #copy_to
- #cp
- #eql?
- #hash
- #inspect
- #move_to
- #read_all
- #remove
- #reproducible?
- #rm
- #ropen
- #size
- #string
- #to_s
- #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::StringPort

StringPort

### Public Class Methods

new( str = '' ) click to toggle source

    # File lib/tmail/port.rb, line 301
    def initialize( str = '' )
      @buffer = str
      super()
    end

### Public Instance Methods

==( other ) click to toggle source

    # File lib/tmail/port.rb, line 320
    def ==( other )
      StringPort === other and @buffer.equal? other.string
    end

Also aliased as: eql?
aopen( &block ) click to toggle source

    # File lib/tmail/port.rb, line 348
    def aopen( &block )
      @buffer ||= ''
      StringOutput.new(@buffer, &block)
    end

copy_to( port ) click to toggle source

    # File lib/tmail/port.rb, line 359
    def copy_to( port )
      port.wopen {|f|
          f.write @buffer
      }
    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 326
    def hash
      @buffer.object_id.hash
    end

inspect() click to toggle source

    # File lib/tmail/port.rb, line 330
    def inspect
      "#<#{self.class}:id=#{sprintf '0x%x', @buffer.object_id}>"
    end

move_to( port ) click to toggle source

    # File lib/tmail/port.rb, line 367
    def move_to( port )
      if StringPort === port
        str = @buffer
        port.instance_eval { @buffer = str }
      else
        copy_to port
      end
      remove
    end

read_all() click to toggle source
Alias for: to_s
remove() click to toggle source

    # File lib/tmail/port.rb, line 353
    def remove
      @buffer = nil
    end

Also aliased as: rm
reproducible?() click to toggle source

    # File lib/tmail/port.rb, line 334
    def reproducible?
      true
    end

rm() click to toggle source
Alias for: remove
ropen( &block ) click to toggle source

    # File lib/tmail/port.rb, line 338
    def ropen( &block )
      @buffer or raise Errno::ENOENT, "#{inspect} is already removed"
      StringInput.open(@buffer, &block)
    end

size() click to toggle source

    # File lib/tmail/port.rb, line 316
    def size
      @buffer.size
    end

string() click to toggle source

    # File lib/tmail/port.rb, line 306
    def string
      @buffer
    end

to_s() click to toggle source

    # File lib/tmail/port.rb, line 310
    def to_s
      @buffer.dup
    end

Also aliased as: read_all
wopen( &block ) click to toggle source

    # File lib/tmail/port.rb, line 343
    def wopen( &block )
      @buffer = ''
      StringOutput.new(@buffer, &block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.