зеркало из https://github.com/github/ruby.git
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:
Родитель
40d7c9c18b
Коммит
0ede9926f7
|
@ -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"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче