1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

2000-02-25

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-02-25 03:51:23 +00:00
parent e13f96f413
commit 7ed66b9e1d
10 changed files with 114 additions and 80 deletions

View file

@ -9,25 +9,25 @@ class Mail
@header = {}
@body = []
begin
while f.gets()
$_.chop!
next if /^From / # skip From-line
break if /^$/ # end of header
while line = f.gets()
line.chop!
next if /^From /=~line # skip From-line
break if /^$/=~line # end of header
if /^(\S+):\s*(.*)/
if /^(\S+):\s*(.*)/=~line
(attr = $1).capitalize!
@header[attr] = $2
elsif attr
sub!(/^\s*/, '')
@header[attr] += "\n" + $_
line.sub!(/^\s*/, '')
@header[attr] += "\n" + line
end
end
return unless $_
return unless line
while f.gets()
break if /^From /
@body.push($_)
while line = f.gets()
break if /^From /=~line
@body.push(line)
end
ensure
f.close if opened