File tree 1 file changed +10
-15
lines changed
1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
require_relative '../../puppet/ssl'
2
2
3
3
module Puppet ::SSL
4
+ # The `keyword_init: true` option is no longer needed in Ruby >= 3.2
4
5
SSLContext = Struct . new (
5
6
:store ,
6
7
:cacerts ,
@@ -9,22 +10,16 @@ module Puppet::SSL
9
10
:client_cert ,
10
11
:client_chain ,
11
12
:revocation ,
12
- :verify_peer
13
+ :verify_peer ,
14
+ keyword_init : true
13
15
) do
14
- DEFAULTS = {
15
- cacerts : [ ] ,
16
- crls : [ ] ,
17
- client_chain : [ ] ,
18
- revocation : true ,
19
- verify_peer : true
20
- } . freeze
21
-
22
- # This is an idiom to initialize a Struct from keyword
23
- # arguments. Ruby 2.5 introduced `keyword_init: true` for
24
- # that purpose, but we need to support older versions.
25
- def initialize ( kwargs = { } )
26
- super ( { } )
27
- DEFAULTS . merge ( **kwargs ) . each { |k , v | self [ k ] = v }
16
+ def initialize ( *)
17
+ super
18
+ self [ :cacerts ] ||= [ ]
19
+ self [ :crls ] ||= [ ]
20
+ self [ :client_chain ] ||= [ ]
21
+ self [ :revocation ] = true if self [ :revocation ] . nil?
22
+ self [ :verify_peer ] = true if self [ :verify_peer ] . nil?
28
23
end
29
24
end
30
25
end
You can’t perform that action at this time.
0 commit comments