Class: Filter::ByContent
- Defined in:
- lib/mailhandler/receiving/filter.rb
Instance Method Summary collapse
- #get(pattern) ⇒ Object
-
#initialize(content) ⇒ ByContent
constructor
A new instance of ByContent.
Methods inherited from Base
Constructor Details
#initialize(content) ⇒ ByContent
Returns a new instance of ByContent.
57 58 59 60 61 |
# File 'lib/mailhandler/receiving/filter.rb', line 57 def initialize(content) @content = content end |
Instance Method Details
#get(pattern) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/mailhandler/receiving/filter.rb', line 63 def get(pattern) files = super(pattern) matched_files = [] files.each do |file| begin content = File.read(file) matched_files << file if content.include? @content rescue # skip file reading if file is not there anymore end end matched_files end |