mbox 0.0.4.3 → 0.0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/mbox/mail.rb +8 -3
  2. data/lib/mbox/mbox.rb +3 -1
  3. metadata +1 -1
@@ -34,11 +34,12 @@ class Mail
34
34
  return if !line || line.empty?
35
35
 
36
36
  # metadata parsing
37
- begin
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 until input.eof? || (line = input.readline).match(options[:separator])
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:#{headers['From']}>"
100
+ "#<Mail:#{from}>"
96
101
  end
97
102
  end
98
103
 
@@ -138,7 +138,9 @@ class Mbox
138
138
  length = 0
139
139
 
140
140
  lock {
141
- while line = @input.readline rescue nil
141
+ until @input.eof?
142
+ line = @input.readline
143
+
142
144
  if line.match(options[:separator]) && last.chomp.empty?
143
145
  length += 1
144
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.3
4
+ version: 0.0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: