Skip to content

Commit

Permalink
Fixes to remove some eval code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Carlson committed Jun 23, 2009
1 parent c9757d2 commit 0915f34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/simple-rss.rb
Expand Up @@ -2,7 +2,7 @@
require 'time'

class SimpleRSS
VERSION = "1.2.1"
VERSION = "1.2.2"

attr_reader :items, :source
alias :entries :items
Expand Down Expand Up @@ -36,7 +36,7 @@ class SimpleRSS
def initialize(source, options={})
@source = source.respond_to?(:read) ? source.read : source.to_s
@items = Array.new
@options = options
@options = Hash.new.update(options)

parse
end
Expand Down Expand Up @@ -86,8 +86,8 @@ def parse

if $2 || $3
tag_cleaned = clean_tag(tag)
eval %{ @#{ tag_cleaned } = clean_content(tag, $2, $3) }
self.class.class_eval %{ attr_reader :#{ tag_cleaned } } unless @options[:marshalable]
instance_variable_set("@#{ tag_cleaned }", clean_content(tag, $2, $3))
self.class.send(:attr_reader, tag_cleaned)
end
end

Expand Down
2 changes: 1 addition & 1 deletion simple-rss.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "simple-rss"
s.version = "1.2.1"
s.version = "1.2.2"
s.date = "2009-02-25"
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."
s.email = "lucas@rufy.com"
Expand Down
4 changes: 2 additions & 2 deletions test/base/base_test.rb
@@ -1,8 +1,8 @@
require File.dirname(__FILE__) + '/../test_helper'
class BaseTest < Test::Unit::TestCase
def setup
@rss09 = SimpleRSS.parse open(File.dirname(__FILE__) + '/../data/rss09.rdf'), true
@rss20 = SimpleRSS.parse open(File.dirname(__FILE__) + '/../data/rss20.xml'), false
@rss09 = SimpleRSS.parse open(File.dirname(__FILE__) + '/../data/rss09.rdf')
@rss20 = SimpleRSS.parse open(File.dirname(__FILE__) + '/../data/rss20.xml')
@atom = SimpleRSS.parse open(File.dirname(__FILE__) + '/../data/atom.xml')
end

Expand Down

0 comments on commit 0915f34

Please sign in to comment.