bodyparts 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bodyparts.gemspec +1 -1
- data/lib/bodyparts.rb +8 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bodyparts.gemspec
CHANGED
data/lib/bodyparts.rb
CHANGED
@@ -27,11 +27,13 @@ class BodyParts
|
|
27
27
|
body = email.body.raw_source
|
28
28
|
end
|
29
29
|
|
30
|
-
matches = []
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
matches = rules.map {|rule| body.match(rule[:reply_delimiter])}.compact!
|
31
|
+
unless matches.empty?
|
32
|
+
match = matches.sort_by {|m| m.begin(0)}.first
|
33
|
+
new_message = body[0, match.begin(0)]
|
34
|
+
{:new_message => new_message.strip, :rest_of_thread => body[match.begin(0)..-1].strip}
|
35
|
+
else
|
36
|
+
body
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|