mbox 0.0.4.3 → 0.0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mbox/mail.rb +8 -3
- data/lib/mbox/mbox.rb +3 -1
- metadata +1 -1
data/lib/mbox/mail.rb
CHANGED
@@ -34,11 +34,12 @@ class Mail
|
|
34
34
|
return if !line || line.empty?
|
35
35
|
|
36
36
|
# metadata parsing
|
37
|
-
|
37
|
+
metadata.parse_from line
|
38
|
+
until input.eof? || (line = input.readline).match(options[:separator])
|
38
39
|
break unless line.match(/^>+/)
|
39
40
|
|
40
41
|
metadata.parse_from line
|
41
|
-
end
|
42
|
+
end
|
42
43
|
|
43
44
|
# headers parsing
|
44
45
|
current = ''
|
@@ -77,6 +78,10 @@ class Mail
|
|
77
78
|
@content = content
|
78
79
|
end
|
79
80
|
|
81
|
+
def from
|
82
|
+
metadata.from.first.name
|
83
|
+
end
|
84
|
+
|
80
85
|
def save_to (path)
|
81
86
|
File.open(path, 'w') {|f|
|
82
87
|
f.write to_s
|
@@ -92,7 +97,7 @@ class Mail
|
|
92
97
|
end
|
93
98
|
|
94
99
|
def inspect
|
95
|
-
"#<Mail:#{
|
100
|
+
"#<Mail:#{from}>"
|
96
101
|
end
|
97
102
|
end
|
98
103
|
|
data/lib/mbox/mbox.rb
CHANGED