jsl-feedtosis 0.0.3.1 → 0.0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/feedtosis.gemspec +3 -4
- data/lib/feedtosis/result.rb +11 -25
- metadata +1 -3
- data/spec/feedtosis_spec.rb +0 -5
data/feedtosis.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{feedtosis}
|
3
|
-
s.version = "0.0.3.
|
3
|
+
s.version = "0.0.3.2"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Justin Leitgeb"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
"spec/extensions/feed_normalizer/feed_instance_methods_spec.rb",
|
17
17
|
"spec/fixtures/http_headers/wooster.txt",
|
18
18
|
"spec/fixtures/xml/older_wooster.xml", "spec/fixtures/xml/wooster.xml",
|
19
|
-
"spec/feedtosis/client_spec.rb",
|
19
|
+
"spec/feedtosis/client_spec.rb",
|
20
20
|
"spec/feedtosis/result_spec.rb",
|
21
21
|
"spec/spec_helper.rb"]
|
22
22
|
|
@@ -26,8 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.require_paths = ["lib"]
|
27
27
|
s.rubygems_version = %q{1.3.1}
|
28
28
|
s.summary = %q{Retrieves feeds using conditional GET and marks entries that you haven't seen before}
|
29
|
-
s.test_files = ["spec/
|
30
|
-
"spec/feedtosis/result_spec.rb" ]
|
29
|
+
s.test_files = ["spec/spec_helper.rb", "spec/feedtosis/client_spec.rb", "spec/feedtosis/result_spec.rb" ]
|
31
30
|
|
32
31
|
s.extra_rdoc_files = [ "README.rdoc" ]
|
33
32
|
|
data/lib/feedtosis/result.rb
CHANGED
@@ -7,17 +7,8 @@ module Feedtosis
|
|
7
7
|
# these cases, depending on your business logic you may want to inspect the
|
8
8
|
# state of the Curl::Easy object by using methods forwarded to it.
|
9
9
|
class Result
|
10
|
-
|
11
|
-
|
12
|
-
FEED_METHODS = [ :title, :description, :last_updated, :copyright, :authors,
|
13
|
-
:author, :urls, :url, :image, :generator, :items, :entries, :new_items,
|
14
|
-
:new_entries, :channel, :ttl, :skip_hours, :skip_days
|
15
|
-
] unless defined?(FEED_METHODS)
|
16
|
-
|
17
|
-
# Precompiled regexp for detecting removing setter methods from collection
|
18
|
-
# of methods to be delegated to the Curl::Easy object.
|
19
|
-
SETTER_METHOD_RE = /=$/o unless defined?(SETTER_METHOD_RE)
|
20
|
-
|
10
|
+
extend Forwardable
|
11
|
+
|
21
12
|
def initialize(curl, feed)
|
22
13
|
@curl = curl
|
23
14
|
@feed = feed
|
@@ -25,22 +16,17 @@ module Feedtosis
|
|
25
16
|
raise ArgumentError, "Curl object must not be nil" if curl.nil?
|
26
17
|
end
|
27
18
|
|
28
|
-
# See what the Curl::Easy object responds to, and send any appropriate
|
29
|
-
#
|
30
|
-
|
31
|
-
Curl::Easy.instance_methods(false).reject do |m|
|
32
|
-
m =~ SETTER_METHOD_RE
|
33
|
-
end.each do |meth| # Example method:
|
34
|
-
define_method meth do |*args| # def title
|
35
|
-
@curl.__send__(meth, *args) # @curl.title
|
36
|
-
end # end
|
37
|
-
end
|
19
|
+
# See what the Curl::Easy object responds to, and send any appropriate messages its way. We ignore
|
20
|
+
# Curl setter methods since those aren't really useful to delegate.
|
21
|
+
def_delegators :@curl, *Curl::Easy.instance_methods(false).reject {|m| m =~ /=$/o }
|
38
22
|
|
39
|
-
# Send methods through to the feed object unless it is nil. If feed
|
40
|
-
#
|
41
|
-
|
23
|
+
# Send methods through to the feed object unless it is nil. If feed object is nil, return nil in response to method call.
|
24
|
+
# Unfortunately we can't just see what the object responds to, since FeedNormalizer uses method_missing.
|
25
|
+
[ :title, :description, :last_updated, :copyright, :authors, :author, :urls, :url, :image, :generator, :items,
|
26
|
+
:entries, :new_items, :new_entries, :channel, :ttl, :skip_hours, :skip_days
|
27
|
+
].each do |meth| # Example method:
|
42
28
|
define_method meth do |*args| # def author
|
43
|
-
@feed.
|
29
|
+
@feed.__send__(meth, *args) unless @feed.nil? # @feed.author unless @feed.nil?
|
44
30
|
end # end
|
45
31
|
end
|
46
32
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsl-feedtosis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.
|
4
|
+
version: 0.0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Leitgeb
|
@@ -76,7 +76,6 @@ files:
|
|
76
76
|
- spec/fixtures/xml/older_wooster.xml
|
77
77
|
- spec/fixtures/xml/wooster.xml
|
78
78
|
- spec/feedtosis/client_spec.rb
|
79
|
-
- spec/feedtosis_spec.rb
|
80
79
|
- spec/feedtosis/result_spec.rb
|
81
80
|
- spec/spec_helper.rb
|
82
81
|
has_rdoc: true
|
@@ -112,7 +111,6 @@ signing_key:
|
|
112
111
|
specification_version: 2
|
113
112
|
summary: Retrieves feeds using conditional GET and marks entries that you haven't seen before
|
114
113
|
test_files:
|
115
|
-
- spec/feedtosis_spec.rb
|
116
114
|
- spec/spec_helper.rb
|
117
115
|
- spec/feedtosis/client_spec.rb
|
118
116
|
- spec/feedtosis/result_spec.rb
|