Feature #6819 ยป openssl.digest.module_function.patch
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)
|