From 463c6a218fed7248531a002806e9b07be7f5a6ea Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 17 Jun 2006 01:04:31 +0000 Subject: * lib/rss, test/rss: backported from trunk. (2005-11-16 - now) * lib/rss/rss.rb: added backward compatibility codes. * lib/rss/parser.rb: ditto. * test/rss/test_parser.rb: ditto. * test/rss/test_2.0.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rss/parser.rb | 16 ++++++++++++++-- lib/rss/rss.rb | 8 ++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index 73cce6b7a0..ace3d262f8 100644 --- a/lib/rss/parser.rb +++ b/lib/rss/parser.rb @@ -1,5 +1,17 @@ require "forwardable" -require "open-uri" +begin + require "open-uri" +rescue LoadError + require "uri" +end +unless Kernel.methods.include?("URI") + module Kernel + def URI(uri_str) # :doc: + URI.parse(uri_str) + end + module_function :URI + end +end require "rss/rss" @@ -414,7 +426,7 @@ module RSS end previous = @last_element - next_element = klass.__send__(:new, *args) + next_element = klass.new(*args) next_element.do_validate = @do_validate previous.instance_eval {set_next_element(tag_name, next_element)} @last_element = next_element diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 589478665c..f424f16171 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -52,6 +52,14 @@ class Hash end end +module Kernel + unless methods.include?("funcall") + def funcall(*args, &block) + __send__(*args, &block) + end + end +end + require "English" require "rss/utils" require "rss/converter" -- cgit v1.2.3