Parent

Class/Module Index [+]

Quicksearch

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.