Project

General

Profile

Bug #9494 ยป require-digest-upfront.patch

Conrad.Irwin (Conrad Irwin), 02/06/2014 07:51 AM

View differences:

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
    (1-1/1)