cardmagic-simple-rss 1.2 → 1.2.1
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/lib/simple-rss.rb +8 -7
- data/simple-rss.gemspec +1 -1
- metadata +1 -1
data/lib/simple-rss.rb
CHANGED
@@ -2,7 +2,7 @@ require 'cgi'
|
|
2
2
|
require 'time'
|
3
3
|
|
4
4
|
class SimpleRSS
|
5
|
-
VERSION = "1.2"
|
5
|
+
VERSION = "1.2.1"
|
6
6
|
|
7
7
|
attr_reader :items, :source
|
8
8
|
alias :entries :items
|
@@ -33,10 +33,11 @@ class SimpleRSS
|
|
33
33
|
:'feedburner:origLink'
|
34
34
|
]
|
35
35
|
|
36
|
-
def initialize(source)
|
36
|
+
def initialize(source, options={})
|
37
37
|
@source = source.respond_to?(:read) ? source.read : source.to_s
|
38
38
|
@items = Array.new
|
39
|
-
|
39
|
+
@options = options
|
40
|
+
|
40
41
|
parse
|
41
42
|
end
|
42
43
|
|
@@ -59,8 +60,8 @@ class SimpleRSS
|
|
59
60
|
end
|
60
61
|
|
61
62
|
# The strict attribute is for compatibility with Ruby's standard RSS parser
|
62
|
-
def parse(source,
|
63
|
-
new source
|
63
|
+
def parse(source, options={})
|
64
|
+
new source, options
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -86,7 +87,7 @@ class SimpleRSS
|
|
86
87
|
if $2 || $3
|
87
88
|
tag_cleaned = clean_tag(tag)
|
88
89
|
eval %{ @#{ tag_cleaned } = clean_content(tag, $2, $3) }
|
89
|
-
self.class.class_eval %{ attr_reader :#{ tag_cleaned } }
|
90
|
+
self.class.class_eval %{ attr_reader :#{ tag_cleaned } } unless @options[:marshalable]
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
@@ -140,7 +141,7 @@ class SimpleRSS
|
|
140
141
|
if content =~ /([^-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]%)/n then
|
141
142
|
CGI.unescape(content).gsub(/(<!\[CDATA\[|\]\]>)/,'').strip
|
142
143
|
else
|
143
|
-
content
|
144
|
+
content.gsub(/(<!\[CDATA\[|\]\]>)/,'').strip
|
144
145
|
end
|
145
146
|
end
|
146
147
|
end
|
data/simple-rss.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "simple-rss"
|
3
|
-
s.version = "1.2"
|
3
|
+
s.version = "1.2.1"
|
4
4
|
s.date = "2009-02-25"
|
5
5
|
s.summary = "A simple, flexible, extensible, and liberal RSS and Atom reader for Ruby. It is designed to be backwards compatible with the standard RSS parser, but will never do RSS generation."
|
6
6
|
s.email = "lucas@rufy.com"
|