drewolson-pipe 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pipe.rb +5 -5
- metadata +2 -2
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.
|
6
|
+
VERSION = '0.1.3'
|
7
7
|
HEADER = %q{<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel>}
|
8
8
|
FOOTER = %q{</channel></rss>}
|
9
9
|
|
@@ -12,10 +12,10 @@ class Pipe
|
|
12
12
|
def self.create(&block)
|
13
13
|
pipe = Pipe.new
|
14
14
|
|
15
|
-
if block.arity
|
16
|
-
pipe.instance_eval(&block)
|
17
|
-
else
|
15
|
+
if block.arity == 1
|
18
16
|
block.call(pipe)
|
17
|
+
else
|
18
|
+
pipe.instance_eval(&block)
|
19
19
|
end
|
20
20
|
|
21
21
|
HEADER + pipe.content + FOOTER
|
@@ -26,7 +26,7 @@ class Pipe
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def feed(url,filters={})
|
29
|
-
enum = (filters[:combine_with] == :
|
29
|
+
enum = (filters[:combine_with] == :or ? :any? : :all?)
|
30
30
|
filters.delete(:combine_with)
|
31
31
|
|
32
32
|
doc = Hpricot.XML(open(url))
|
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.
|
4
|
+
version: 0.1.3
|
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
|
+
date: 2008-12-23 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|