From 36237de13746beb8e1740ebd391a4caba07b02c8 Mon Sep 17 00:00:00 2001 From: kou Date: Thu, 13 Jul 2006 11:35:17 +0000 Subject: * lib/rss/parser.rb: updated documents by a patch from Hugh Sasse . [ruby-core:8194] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/rss/parser.rb | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 260fa651c7..e829e706c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 13 20:32:19 2006 Kouhei Sutou + + * lib/rss/parser.rb: updated documents by a patch from + Hugh Sasse . [ruby-core:8194] + Tue Jul 11 19:13:33 2006 Hidetoshi NAGAI * ext/tk/lib/multi-tk.rb: remove restriction on the class of diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index a59c16f007..6f5696edae 100644 --- a/lib/rss/parser.rb +++ b/lib/rss/parser.rb @@ -21,15 +21,16 @@ module RSS class XMLParserNotFound < Error def initialize - super("available XML parser does not found in " << + super("available XML parser was not found in " << "#{AVAILABLE_PARSER_LIBRARIES.inspect}.") end end class NotValidXMLParser < Error def initialize(parser) - super("#{parser} is not available XML parser. " << - "available XML parser is " << + super("#{parser} is not an available XML parser. " << + "Available XML parser"<< + (AVAILABLE_PARSERS.size > 1 ? "s are ": " is ") << "#{AVAILABLE_PARSERS.inspect}.") end end @@ -55,6 +56,8 @@ module RSS @@default_parser || AVAILABLE_PARSERS.first end + # Set @@default_parser to new_value if it is one of the + # available parsers. Else raise NotValidXMLParser error. def default_parser=(new_value) if AVAILABLE_PARSERS.include?(new_value) @@default_parser = new_value @@ -96,10 +99,13 @@ module RSS end end + # maybe_xml? tests if source is a string that looks like XML. def maybe_xml?(source) source.is_a?(String) and /