drewolson-pipe 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. data/History.txt +12 -0
  2. data/README.txt +28 -0
  3. data/lib/pipe.rb +2 -1
  4. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ === 0.1.2 / 2008-12-14
2
+
3
+ * 1 bug fix
4
+
5
+ * :combine_with is removed from filters before filtering
6
+
7
+ === 0.1.1 / 2008-12-12
8
+
9
+ * 1 enhancement
10
+
11
+ * create block can yield an instance
12
+
1
13
  === 0.1.0 / 2008-12-10
2
14
 
3
15
  * 1 major enhancement
data/README.txt CHANGED
@@ -34,9 +34,37 @@ plus patterns those tags must fit. Use with sinatra, easy as pie.
34
34
  Now enjoy some RSS goodness personally tailored to you at
35
35
  http://localhost:4567
36
36
 
37
+ We can get a bit more complicated with pipe in a couple ways. First, if you
38
+ have some information in scope that you want your pipe block to close over,
39
+ you can prevent pipe from doing an instance eval by providing a block
40
+ argument. In this case, the block will yield an instance of the Pipe object:
41
+
42
+ get '/' do
43
+ url = "http://foo.com/rss"
44
+
45
+ Pipe.create do |p|
46
+ p.feed url
47
+ end
48
+ end
49
+
50
+ You can also tell pipe to combine your filter criteria with "or" logic
51
+ instead of the default "and" logic:
52
+
53
+ get '/' do
54
+ Pipe.create do
55
+ feed "http://www.foo.com/rss",
56
+ :title => /foo/,
57
+ :description => /bar/,
58
+ :combine_with => :or
59
+ end
60
+ end
61
+
62
+ Happy piping!
63
+
37
64
  == REQUIREMENTS:
38
65
 
39
66
  * pipe
67
+ * hpricot
40
68
 
41
69
  == INSTALL:
42
70
 
data/lib/pipe.rb CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'hpricot'
4
4
 
5
5
  class Pipe
6
- VERSION = '0.1.1'
6
+ VERSION = '0.1.2'
7
7
  HEADER = %q{<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel>}
8
8
  FOOTER = %q{</channel></rss>}
9
9
 
@@ -27,6 +27,7 @@ class Pipe
27
27
 
28
28
  def feed(url,filters={})
29
29
  enum = (filters[:combine_with] == :and ? :all? : :any?)
30
+ filters.delete(:combine_with)
30
31
 
31
32
  doc = Hpricot.XML(open(url))
32
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drewolson-pipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Olson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-12 00:00:00 -08:00
12
+ date: 2008-12-14 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency