aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/indexer.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 23:46:47 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 23:46:47 +0000
commit934f537b458778f4786716c95b73fc72bc1ce256 (patch)
tree6abdecd9956995a7f82c9f969c80657b4301f6bd /lib/rubygems/indexer.rb
parentb511e1bfbe649b938e317e00ad1795f1b9623758 (diff)
downloadruby-934f537b458778f4786716c95b73fc72bc1ce256.tar.gz
Import rubygems 1.5.0 (release candidate @ 09893d9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/indexer.rb')
-rw-r--r--lib/rubygems/indexer.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index e1265c2d34..1a585c3c25 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -63,7 +63,7 @@ class Gem::Indexer
require 'tmpdir'
require 'zlib'
- unless ''.respond_to? :to_xs then
+ unless defined?(Builder::XChar) then
raise "Gem::Indexer requires that the XML Builder library be installed:" \
"\n\tgem install builder"
end
@@ -555,10 +555,18 @@ class Gem::Indexer
# Sanitize a single string.
def sanitize_string(string)
+ return string unless string
+
# HACK the #to_s is in here because RSpec has an Array of Arrays of
- # Strings for authors. Need a way to disallow bad values on gempsec
+ # Strings for authors. Need a way to disallow bad values on gemspec
# generation. (Probably won't happen.)
- string ? string.to_s.to_xs : string
+ string = string.to_s
+
+ begin
+ Builder::XChar.encode string
+ rescue NameError, NoMethodError
+ string.to_xs
+ end
end
##