Methods
- ==
- aopen
- copy_file
- copy_to
- cp
- eql?
- hash
- inspect
- move_to
- mv
- new
- read_all
- remove
- reproducible?
- ropen
- size
- wopen
Attributes
| [R] | filename |
Public Class methods
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 48
48: def initialize( fname )
49: @filename = File.expand_path(fname)
50: super()
51: end
Public Instance methods
This method is also aliased as
eql?
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 57
57: def ==( other )
58: other.respond_to?(:filename) and @filename == other.filename
59: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 88
88: def aopen( &block )
89: File.open(@filename, 'a', &block)
90: end
This method is also aliased as
cp
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 115
115: def copy_to( port )
116: if FilePort === port
117: copy_file @filename, port.filename
118: else
119: File.open(@filename) {|r|
120: port.wopen {|w|
121: while s = r.sysread(4096)
122: w.write << s
123: end
124: } }
125: end
126: end
Alias for copy_to
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 63
63: def hash
64: @filename.hash
65: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 67
67: def inspect
68: "#<#{self.class}:#{@filename}>"
69: end
This method is also aliased as
mv
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 104
104: def move_to( port )
105: begin
106: File.link @filename, port.filename
107: rescue Errno::EXDEV
108: copy_to port
109: end
110: File.unlink @filename
111: end
Alias for move_to
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 93
93: def read_all
94: ropen {|f|
95: return f.read
96: }
97: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 100
100: def remove
101: File.unlink @filename
102: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 71
71: def reproducible?
72: true
73: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 80
80: def ropen( &block )
81: File.open(@filename, &block)
82: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 75
75: def size
76: File.size @filename
77: end
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 84
84: def wopen( &block )
85: File.open(@filename, 'w', &block)
86: end
Private Instance methods
from fileutils.rb
[ show source ]
# File lib/action_mailer/vendor/tmail/port.rb, line 133
133: def copy_file( src, dest )
134: st = r = w = nil
135:
136: File.open(src, 'rb') {|r|
137: File.open(dest, 'wb') {|w|
138: st = r.stat
139: begin
140: while true
141: w.write r.sysread(st.blksize)
142: end
143: rescue EOFError
144: end
145: } }
146: end