diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-14 12:46:56 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-14 12:46:56 +0000 |
| commit | b9405f10a1b042b653bccbd9b0d5dcd8bf55d522 (patch) | |
| tree | 26034262511b4de658611f25e51146312489927b | |
| parent | d99a3948e29cfd6538fc49697eb79cc9e3bacd87 (diff) | |
| download | ruby-b9405f10a1b042b653bccbd9b0d5dcd8bf55d522.tar.gz ruby-b9405f10a1b042b653bccbd9b0d5dcd8bf55d522.tar.xz ruby-b9405f10a1b042b653bccbd9b0d5dcd8bf55d522.zip | |
* ext/digest/lib/digest.rb (Digest::self.const_missing): Drop
autoloads for sha2 classes in favor of handling in
const_missing(), to work around a problem exposed on OS X.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@11737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | ext/digest/lib/digest.rb | 18 |
2 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,9 @@ +Wed Feb 14 19:22:15 2007 Akinori MUSHA <knu@iDaemons.org> + + * ext/digest/lib/digest.rb (Digest::self.const_missing): Drop + autoloads for sha2 classes in favor of handling in + const_missing(), to work around a problem exposed on OS X. + Tue Feb 13 02:21:12 2007 Sam Roberts <sroberts@uniserve.com> * io.c (rb_f_syscall): Fix buffer overflow with syscall diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb index 578c6f53d..244cd436b 100644 --- a/ext/digest/lib/digest.rb +++ b/ext/digest/lib/digest.rb @@ -1,19 +1,21 @@ require 'digest.so' module Digest - autoload "SHA256", "digest/sha2.so" - autoload "SHA384", "digest/sha2.so" - autoload "SHA512", "digest/sha2.so" - def self.const_missing(name) - begin - require File.join('digest', name.to_s.downcase) + case name + when :SHA256, :SHA384, :SHA512 + lib = 'digest/sha2.so' + else + lib = File.join('digest', name.to_s.downcase) + end - return Digest.const_get(name) if Digest.const_defined?(name) + begin + require lib rescue LoadError => e + raise LoadError, "library not found for class Digest::#{name} -- #{lib}" end - raise NameError, "Digest class not found: Digest::#{name}" + Digest.const_get(name) end class ::Digest::Class |
