lib/mail_extract/line.rb in mail_extract-0.1.0 vs lib/mail_extract/line.rb in mail_extract-0.1.1
- old
+ new
@@ -13,9 +13,27 @@
def initialize(str)
@body = str
detect_type(str)
end
+ # Returns true if line was detected as text
+ #
+ def text?
+ type == :text
+ end
+
+ # Returns true if line was detected as quote
+ #
+ def quote?
+ type == :quote
+ end
+
+ # Returns true if line was detected as signature
+ #
+ def signature?
+ type == :signature
+ end
+
private
def detect_type(line)
# Detects the start line of quote text
if line.strip =~ /^On/ && line =~ /at [\d:]+/ && line.strip =~ /wrote:?\z/