From 15b590ed4682beebed28028dde79aa8bfcc045ae 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rss/parser.rb | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index a59c16f00..6f5696eda 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 /