Bug #9494 ยป require-digest-upfront.patch
ext/digest/lib/digest.rb | ||
---|---|---|
require 'digest.so'
|
||
require 'digest/md5'
|
||
require 'digest/sha1'
|
||
require 'digest/sha2'
|
||
require 'digest/bubblebabble'
|
||
require 'digest/rmd160'
|
||
module Digest
|
||
def self.const_missing(name) # :nodoc:
|
||
case name
|
||
when :SHA256, :SHA384, :SHA512
|
||
lib = 'digest/sha2.so'
|
||
else
|
||
lib = File.join('digest', name.to_s.downcase)
|
||
end
|
||
begin
|
||
require lib
|
||
rescue LoadError
|
||
raise LoadError, "library not found for class Digest::#{name} -- #{lib}", caller(1)
|
||
end
|
||
unless Digest.const_defined?(name)
|
||
raise NameError, "uninitialized constant Digest::#{name}", caller(1)
|
||
end
|
||
Digest.const_get(name)
|
||
end
|
||
class ::Digest::Class
|
||
# Creates a digest object and reads a given file, _name_.
|
||
# Optional arguments are passed to the constructor of the digest
|