feedfilter 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +2 -0
- data/lib/feedfilter/includes.rb +43 -0
- data/lib/feedfilter/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c9639477e4c2ad8e2998fdab012d3286c898be3
|
4
|
+
data.tar.gz: 0dcb6ae11eb38db7415f0b0ef27066b11c64156f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d4c76226a1a0b8b2f18dd0331ec320de90aa2f98d61d74694fd7c908babfd2ff65ab31d1180d32b6e3667e2f058ad2dbdd03ec3a1e9d2956ca541af03d04877
|
7
|
+
data.tar.gz: dd537b8f5599605a613eb04ab4eb9d2bc92a42c4d03bf4c3ae6020bdfdbbf3659b9a6fdf32d8ab4e276214f9fcc5c61a2c8f0c4834897951112e12278d82fee9
|
data/Manifest.txt
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
module FeedFilter
|
5
|
+
|
6
|
+
|
7
|
+
class IncludeFilters
|
8
|
+
|
9
|
+
include LogUtils::Logging
|
10
|
+
|
11
|
+
def initialize( includes )
|
12
|
+
@includes = includes
|
13
|
+
|
14
|
+
## split terms (allow comma,pipe) - do NOT use space; allows e.g. terms such as github pages
|
15
|
+
@terms = includes.split( /\s*[,|]\s*/ )
|
16
|
+
## remove leading and trailing white spaces - check - still required when using \s* ??
|
17
|
+
@terms = @terms.map { |term| term.strip }
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def match_item?( item )
|
22
|
+
match_terms?( item.title ) ||
|
23
|
+
match_terms?( item.summary ) ||
|
24
|
+
match_terms?( item.content )
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def match_terms?( text ) ### make helper method private - why? why not??
|
30
|
+
return false if text.nil? || text.empty? ## allow/guard against nil and empty string (use blank?)
|
31
|
+
|
32
|
+
@terms.each do |term|
|
33
|
+
if /#{term}/i =~ text ## Note: lets ignore case (use i regex option)
|
34
|
+
return true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
false # no term match found
|
39
|
+
end
|
40
|
+
|
41
|
+
end # class IncludeFilters
|
42
|
+
|
43
|
+
end # module FeedFilter
|
data/lib/feedfilter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedfilter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- config/feedflare.txt
|
73
73
|
- lib/feedfilter.rb
|
74
74
|
- lib/feedfilter/ads.rb
|
75
|
+
- lib/feedfilter/includes.rb
|
75
76
|
- lib/feedfilter/version.rb
|
76
77
|
- test/helper.rb
|
77
78
|
- test/test_ads.rb
|