From df05bd2c82386e5897c4125576199e18a13712a1 Mon Sep 17 00:00:00 2001 From: emboss Date: Thu, 2 Aug 2012 01:58:49 +0000 Subject: * ext/openssl/lib/openssl/digest.rb test/openssl/test_digest.rb: Add Digest module function to OpenSSL module and test it. Patch provided by Eric Hodel. [ruby-core:46908][Feature #6819] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/lib/openssl/digest.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ext/openssl/lib/openssl/digest.rb') diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb index b47007165c..43c9974920 100644 --- a/ext/openssl/lib/openssl/digest.rb +++ b/ext/openssl/lib/openssl/digest.rb @@ -68,5 +68,22 @@ module OpenSSL 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 -- cgit v1.2.3