1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

openssl/digest.rb: check by lambda

* ext/openssl/lib/openssl/digest.rb (initialize): check argument
  size by lambda.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-10 07:16:03 +00:00
parent 0ede9926f7
commit d5526f3fe5

View file

@ -42,14 +42,8 @@ module OpenSSL
end
alg.each{|name|
klass = Class.new(Digest){
define_method(:initialize){|*data|
if data.length > 1
raise ArgumentError,
"wrong number of arguments (#{data.length} for 1)"
end
super(name, data.first)
}
klass = Class.new(self) {
define_method(:initialize, ->(data = nil) {super(name, data)})
}
singleton = (class << klass; self; end)
singleton.class_eval{