ruby-changes:32037
From: nobu <ko1@a...>
Date: Tue, 10 Dec 2013 16:16:10 +0900 (JST)
Subject: [ruby-changes:32037] nobu:r44115 (trunk): openssl/digest.rb: get rid of deprecated class
nobu 2013-12-10 16:16:01 +0900 (Tue, 10 Dec 2013) New Revision: 44115 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44115 Log: 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. Modified files: trunk/ext/openssl/lib/openssl/digest.rb trunk/test/openssl/test_digest.rb Index: ext/openssl/lib/openssl/digest.rb =================================================================== --- ext/openssl/lib/openssl/digest.rb (revision 44114) +++ ext/openssl/lib/openssl/digest.rb (revision 44115) @@ -38,7 +38,7 @@ module OpenSSL https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/digest.rb#L38 # OpenSSL::Digest::SHA256.digest("abc") def self.digest(name, data) - super(data, name) + super(data, name) end alg.each{|name| @@ -53,8 +53,8 @@ module OpenSSL https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/digest.rb#L53 } singleton = (class << klass; self; end) singleton.class_eval{ - define_method(:digest){|data| Digest.digest(name, data) } - define_method(:hexdigest){|data| Digest.hexdigest(name, data) } + define_method(:digest){|data| new.digest(data) } + define_method(:hexdigest){|data| new.hexdigest(data) } } const_set(name, klass) } Index: test/openssl/test_digest.rb =================================================================== --- test/openssl/test_digest.rb (revision 44114) +++ test/openssl/test_digest.rb (revision 44115) @@ -4,7 +4,7 @@ if defined?(OpenSSL) https://github.com/ruby/ruby/blob/trunk/test/openssl/test_digest.rb#L4 class OpenSSL::TestDigest < Test::Unit::TestCase def setup - @d1 = OpenSSL::Digest::Digest::new("MD5") + @d1 = OpenSSL::Digest.new("MD5") @d2 = OpenSSL::Digest::MD5.new @md = Digest::MD5.new @data = "DATA" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/