lib/simple-rss.rb in simple-rss-1.2.3 vs lib/simple-rss.rb in simple-rss-1.3.0
- old
+ new
@@ -1,10 +1,10 @@
require 'cgi'
require 'time'
class SimpleRSS
- VERSION = "1.2.3"
+ VERSION = "1.3.0"
attr_reader :items, :source
alias :entries :items
@@feed_tags = [
@@ -89,11 +89,11 @@
end
if $2 || $3
tag_cleaned = clean_tag(tag)
instance_variable_set("@#{ tag_cleaned }", clean_content(tag, $2, $3))
- self.class.send(:attr_reader, tag_cleaned)
+ self.class.class_eval("attr_reader :#{ tag_cleaned }")
end
end
# RSS items' title, link, and description
@source.scan( %r{<(rss:|atom:)?(item|entry)([\s][^>]*)?>(.*?)</(rss:|atom:)?(item|entry)>}mi ) do |match|
@@ -150,15 +150,15 @@
def clean_tag(tag)
tag.to_s.gsub(':','_').intern
end
def unescape(content)
- if content =~ /([^-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]%)/n then
+ if content.force_encoding("binary") =~ /([^-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]%)/n then
CGI.unescape(content).gsub(/(<!\[CDATA\[|\]\]>)/,'').strip
else
content.gsub(/(<!\[CDATA\[|\]\]>)/,'').strip
end
end
end
class SimpleRSSError < StandardError
-end
\ No newline at end of file
+end