Class: FeedFilter::IncludeFilters
- Inherits:
-
Object
- Object
- FeedFilter::IncludeFilters
- Includes:
- LogUtils::Logging
- Defined in:
- lib/feedfilter/includes.rb
Instance Method Summary collapse
-
#initialize(includes) ⇒ IncludeFilters
constructor
A new instance of IncludeFilters.
- #match_item?(item) ⇒ Boolean
Constructor Details
#initialize(includes) ⇒ IncludeFilters
Returns a new instance of IncludeFilters.
11 12 13 14 15 16 17 18 |
# File 'lib/feedfilter/includes.rb', line 11 def initialize( includes ) @includes = includes ## split terms (allow comma,pipe) - do NOT use space; allows e.g. terms such as github pages @terms = includes.split( /\s*[,|]\s*/ ) ## remove leading and trailing white spaces - check - still required when using \s* ?? @terms = @terms.map { |term| term.strip } end |
Instance Method Details
#match_item?(item) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/feedfilter/includes.rb', line 21 def match_item?( item ) match_terms?( item.title ) || match_terms?( item.summary ) || match_terms?( item.content ) end |