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:
parent
0ede9926f7
commit
d5526f3fe5
1 changed files with 2 additions and 8 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Reference in a new issue