jsl-myzofeedtosis 0.0.1.4 → 0.0.1.5

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.
data/README.rdoc CHANGED
@@ -131,6 +131,11 @@ Myzofeedtosis doesn't do anything about feed sanitizing, as other libraries have
131
131
  been built for this purpose. FeedNormalizer has methods for escaping entries,
132
132
  but to strip HTML I suggest that you look at the Ruby gem "sanitize".
133
133
 
134
+ == Credits
135
+
136
+ Thanks to Sander Hartlage (GitHub: Sander6) for useful feedback early in the
137
+ development of Myzofeedtosis.
138
+
134
139
  == Feedback
135
140
 
136
141
  Please let me know if you have any problems with or questions about
@@ -24,14 +24,10 @@ module Myzofeedtosis
24
24
  @options[:backend].except(:moneta_klass) )
25
25
  end
26
26
 
27
- # Retrieves the latest entries from this feed. Returns a
28
- # Feednormalizer::Feed object with method +new_entries+ if the response was
29
- # successful, otherwise returns the Curl::Easy object that we used to
30
- # retrieve this resource. Note that we also return this object if the
31
- # request resulted in a 304 (Not Modified) response code since we don't have
32
- # any new results. Depending on your business logic, you may want to do
33
- # something in this case, such as putting this resource in a lower-priority
34
- # queue if it is not frequently updated.
27
+ # Retrieves the latest entries from this feed. Returns a Myzofeedtosis::Result
28
+ # object which delegates methods to the Curl::Easy object making the request
29
+ # and the FeedNormalizer::Feed object that may have been created from the
30
+ # HTTP response body.
35
31
  def fetch
36
32
  curl = build_curl_easy
37
33
  curl.perform
@@ -5,7 +5,7 @@ module Myzofeedtosis
5
5
  # method calls to the correct object. If FeedNormalizer wasn't able to process
6
6
  # the response, calls which would be delegated to this object return nil. In
7
7
  # these cases, depending on your business logic you may want to inspect the
8
- # state of the Curl::Easy object.
8
+ # state of the Curl::Easy object by using methods forwarded to it.
9
9
  class Result
10
10
 
11
11
  # Methods which should be delegated to the FeedNormalizer::Feed object.
@@ -14,21 +14,26 @@ module Myzofeedtosis
14
14
  :new_entries, :channel, :ttl, :skip_hours, :skip_days
15
15
  ] unless defined?(FEED_METHODS)
16
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
+
17
21
  def initialize(curl, feed)
18
22
  @curl = curl
19
23
  @feed = feed
20
24
 
21
25
  raise ArgumentError, "Curl object must not be nil" if curl.nil?
22
-
23
- # See what the Curl::Easy object responds to, and send any appropriate
24
- # messages its way.
25
- @curl.public_methods(false).each do |meth|
26
- (class << self; self; end).class_eval do
27
- define_method meth do |*args|
28
- @curl.send(meth, *args)
29
- end
30
- end
31
- end
26
+ end
27
+
28
+ # See what the Curl::Easy object responds to, and send any appropriate
29
+ # messages its way. We don't worry about setter methods, since those
30
+ # aren't really useful to delegate.
31
+ Curl::Easy.instance_methods(false).reject do |m|
32
+ m =~ SETTER_METHOD_RE
33
+ end.each do |meth|
34
+ define_method meth do |*args|
35
+ @curl.send(meth, *args)
36
+ end
32
37
  end
33
38
 
34
39
  # Send methods through to the feed object unless it is nil. If feed
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{myzofeedtosis}
3
- s.version = "0.0.1.4"
3
+ s.version = "0.0.1.5"
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"]
@@ -23,6 +23,10 @@ describe Myzofeedtosis::Result do
23
23
  @r.body_str
24
24
  end
25
25
 
26
+ it "should not respond to setter methods common in the Curl::Easy class" do
27
+ @r.should_not respond_to(:encoding=)
28
+ end
29
+
26
30
  it "should return nil for author if the Feed is nil" do
27
31
  r = Myzofeedtosis::Result.new(@c, nil)
28
32
  r.author
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsl-myzofeedtosis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.4
4
+ version: 0.0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Leitgeb