pavlov_rss 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db654d1ad2a3598481166857616cbffccaeb9407
4
- data.tar.gz: 0190333578206965798e596c12d56be51c2c764c
3
+ metadata.gz: d91ce9b913141af881ef622ae4cf34ae1f083048
4
+ data.tar.gz: 50dc7774f5151f018b3b7f262869b3deae99b712
5
5
  SHA512:
6
- metadata.gz: cc89f35da0811807a75a2c32e0ef613baa236f7d317f7d350682952078579bdcc63e945a33014f645ca31594a12aa50a7d1d228c85970f5cb93dc6b3d2a82e8c
7
- data.tar.gz: b0843eca7c4b5ffb368d8dac4a5c0322bafc4e8feeb1e75d98269e26a9d326aedb6604599ef53d07572b7dcaac17bfa16382ca54fc381186bfc79e120eb3601a
6
+ metadata.gz: 279c28c78bb870e5618756a3fc8ce1d80b8e932e9ab73795c2701ec719fdda6184a7498d176dc19bc299a5410a812e334d480428e231973e1a69223a3d573a1d
7
+ data.tar.gz: 8daf15e2e2429f794d19e43a5ef12a08471ac580e771ccb2ad64bb6061ad60b5acb015511902a352ddc89daf45f0f1ec8a042581ba1154faf565fe0ab7a54882
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pavlov_rss (0.0.5)
4
+ pavlov_rss (0.0.6)
5
5
  activesupport
6
6
  nokogiri
7
7
 
@@ -12,10 +12,11 @@ module PavlovRss
12
12
  hash_to_item(rss_to_hash(Nokogiri.XML(@opener.call)))
13
13
  end
14
14
 
15
- def check
15
+ def check &blk
16
16
  now = fetch
17
17
  @prev ||= now
18
18
  result = now - @prev
19
+ result.select!(&blk) if blk
19
20
  @prev = now
20
21
  return result
21
22
  end
@@ -1,3 +1,3 @@
1
1
  module PavlovRss
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -210,5 +210,25 @@ describe PavlovRss::Reader do
210
210
  ]
211
211
  end
212
212
  end
213
+
214
+ it 'works with an filter' do
215
+ fetches = [
216
+ [],
217
+ [
218
+ {'title' => '1-1'},
219
+ {'title' => '2'},
220
+ {'title' => '1-2'},
221
+ ],
222
+ ]
223
+ expected = [
224
+ {'title' => '1-1'},
225
+ {'title' => '1-2'},
226
+ ]
227
+ subject.stub(:fetch).and_return(*fetches)
228
+ subject.check.should be_empty
229
+ subject.check do |item|
230
+ item['title'] =~ /^1/
231
+ end.should == expected
232
+ end
213
233
  end
214
234
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pavlov_rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minwoo Lee
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-03 00:00:00.000000000 Z
12
+ date: 2014-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri