Class: Rounders::Matchers::Body

Inherits:
Matcher
  • Object
show all
Defined in:
lib/rounders/matchers/body.rb

Instance Attribute Summary collapse

Attributes inherited from Matcher

#matchers

Instance Method Summary collapse

Methods inherited from Matcher

build, inherited, symbol

Methods included from Plugins::Pluggable

included

Constructor Details

#initialize(pattern) ⇒ Body



6
7
8
# File 'lib/rounders/matchers/body.rb', line 6

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



4
5
6
# File 'lib/rounders/matchers/body.rb', line 4

def pattern
  @pattern
end

Instance Method Details

#match(mail) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rounders/matchers/body.rb', line 10

def match(mail)
  if mail.multipart?
    mail.text_part.decoded.match(pattern)
  else
    mail.decoded.match(pattern)
  end
end