openssl/digest.rb: get rid of deprecated class

* ext/openssl/lib/openssl/digest.rb (digest, hexdigest): create
  new instance and call on it directly, to get rid of deprecated
  class OpenSSL::Digest::Digest.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-10 07:16:01 +00:00
Родитель 40d7c9c18b
Коммит 0ede9926f7
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -38,7 +38,7 @@ module OpenSSL
# OpenSSL::Digest::SHA256.digest("abc") # OpenSSL::Digest::SHA256.digest("abc")
def self.digest(name, data) def self.digest(name, data)
super(data, name) super(data, name)
end end
alg.each{|name| alg.each{|name|
@ -53,8 +53,8 @@ module OpenSSL
} }
singleton = (class << klass; self; end) singleton = (class << klass; self; end)
singleton.class_eval{ singleton.class_eval{
define_method(:digest){|data| Digest.digest(name, data) } define_method(:digest){|data| new.digest(data) }
define_method(:hexdigest){|data| Digest.hexdigest(name, data) } define_method(:hexdigest){|data| new.hexdigest(data) }
} }
const_set(name, klass) const_set(name, klass)
} }

Просмотреть файл

@ -4,7 +4,7 @@ if defined?(OpenSSL)
class OpenSSL::TestDigest < Test::Unit::TestCase class OpenSSL::TestDigest < Test::Unit::TestCase
def setup def setup
@d1 = OpenSSL::Digest::Digest::new("MD5") @d1 = OpenSSL::Digest.new("MD5")
@d2 = OpenSSL::Digest::MD5.new @d2 = OpenSSL::Digest::MD5.new
@md = Digest::MD5.new @md = Digest::MD5.new
@data = "DATA" @data = "DATA"