Class: ImapMogura::GeneralFieldMatcher

Inherits:
FieldMatcher show all
Defined in:
lib/imap_mogura/rules_parser/rule_elements.rb

Instance Attribute Summary

Attributes inherited from FieldMatcher

#regexp

Instance Method Summary collapse

Constructor Details

#initialize(field_name, regexp) ⇒ GeneralFieldMatcher

Returns a new instance of GeneralFieldMatcher.



130
131
132
133
134
# File 'lib/imap_mogura/rules_parser/rule_elements.rb', line 130

def initialize(field_name, regexp)
  @field_name = field_name

  super(regexp)
end

Instance Method Details

#match?(mail) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
139
# File 'lib/imap_mogura/rules_parser/rule_elements.rb', line 136

def match?(mail)
  debug_out_before_trying_rule("header field \"#{@field_name}\" with value \"#{mail.headers[@field_name]&.value}\" matches the regexp #{@regexp}")
  debug_out_if_it_matches_rule(mail.headers[@field_name]&.value&.match?(@regexp))
end