Project

General

Profile

Feature #6819 ยป openssl.digest.module_function.patch

drbrain (Eric Hodel), 08/02/2012 07:30 AM

View differences:

ext/openssl/lib/openssl/digest.rb (working copy)
end
end # Digest
# Returns a Digest subclass by +name+.
#
# require 'openssl'
#
# OpenSSL::Digest("MD5")
# # => OpenSSL::Digest::MD5
#
# Digest("Foo")
# # => NameError: wrong constant name Foo
def Digest(name)
OpenSSL::Digest.const_get(name)
end
module_function :Digest
end # OpenSSL
test/openssl/test_digest.rb (working copy)
end
end
def test_openssl_digest
assert_equal OpenSSL::Digest::MD5, OpenSSL::Digest("MD5")
assert_raises NameError do
OpenSSL::Digest("no such digest")
end
end
private
def check_digest(oid)
    (1-1/1)