summaryrefslogtreecommitdiff
path: root/lib/rubygems/stub_specification.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-22 22:46:50 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-22 22:46:50 +0000
commit4c2304f0004e9f1784540f3d36976aad9eab1f68 (patch)
treefe5d7f52b7e01644d0a57316aab03299ed0ee5c8 /lib/rubygems/stub_specification.rb
parent66cc0fa4abde68ae360ba2d2cdf4e44bc833e33a (diff)
* lib/rubygems: Import RubyGems from master as of commit b165260
* test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/stub_specification.rb')
-rw-r--r--lib/rubygems/stub_specification.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index 0a6e70bb15..c2910c1bba 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -6,6 +6,13 @@ module Gem
# :nodoc:
PREFIX = "# stub: "
+ OPEN_MODE = # :nodoc:
+ if Object.const_defined? :Encoding then
+ 'r:UTF-8:-'
+ else
+ 'r'
+ end
+
# :nodoc:
class StubLine
attr_reader :parts
@@ -96,7 +103,7 @@ module Gem
def data
unless @data
- File.open(filename, "r:UTF-8:-") do |file|
+ open filename, OPEN_MODE do |file|
begin
file.readline # discard encoding line
stubline = file.readline.chomp