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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5efca587016b13715c7c1e7ed3bf03b6fe179b3f
4
- data.tar.gz: 58f310f10c2ca46c15c99bb8a8ce931b091da90d
3
+ metadata.gz: 7c9639477e4c2ad8e2998fdab012d3286c898be3
4
+ data.tar.gz: 0dcb6ae11eb38db7415f0b0ef27066b11c64156f
5
5
  SHA512:
6
- metadata.gz: b4f621356f34ef04dea7b51fa3121a40aa07d60570ca4e4d86c81da9d7b6de2272f1659e756bbaf5b3e35797a1b277885ecded7d95b52d0e4251a19de97d2ab0
7
- data.tar.gz: 35418794ecf7c405beded9c564511f33f53658f1c253d9f4a2ac134d2c06da0852803429addd5808e3ae51341b4a16488538dc82880b99f8aa1bb4bcc9a0c8e4
6
+ metadata.gz: 6d4c76226a1a0b8b2f18dd0331ec320de90aa2f98d61d74694fd7c908babfd2ff65ab31d1180d32b6e3667e2f058ad2dbdd03ec3a1e9d2956ca541af03d04877
7
+ data.tar.gz: dd537b8f5599605a613eb04ab4eb9d2bc92a42c4d03bf4c3ae6020bdfdbbf3659b9a6fdf32d8ab4e276214f9fcc5c61a2c8f0c4834897951112e12278d82fee9
@@ -6,7 +6,9 @@ config/feedburner.txt
6
6
  config/feedflare.txt
7
7
  lib/feedfilter.rb
8
8
  lib/feedfilter/ads.rb
9
+ lib/feedfilter/includes.rb
9
10
  lib/feedfilter/version.rb
10
11
  test/helper.rb
11
12
  test/test_ads.rb
12
13
  test/test_ads_all.rb
14
+ test/test_includes.rb
@@ -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
@@ -4,7 +4,7 @@ module FeedFilter
4
4
 
5
5
  MAJOR = 1
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
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.0
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