Class: Filter::Email::ByRecipient
- Defined in:
- lib/mailhandler/receiving/filter.rb
Instance Method Summary collapse
- #get(pattern) ⇒ Object
-
#initialize(recipient) ⇒ ByRecipient
constructor
A new instance of ByRecipient.
Methods inherited from Base
Constructor Details
#initialize(recipient) ⇒ ByRecipient
Returns a new instance of ByRecipient.
126 127 128 129 130 |
# File 'lib/mailhandler/receiving/filter.rb', line 126 def initialize(recipient) @recipient = recipient end |
Instance Method Details
#get(pattern) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/mailhandler/receiving/filter.rb', line 132 def get(pattern) files = super(pattern) matched_files = [] files.each do |file| begin content = File.read(file) email = Mail.read_from_string(content) matched_files << file if email[@recipient.keys.first].to_s.include? @recipient.values.first rescue # skip file reading if file is not there anymore end end matched_files end |