File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 11require_relative '../../puppet/ssl'
22
33module Puppet ::SSL
4+ # The `keyword_init: true` option is no longer needed in Ruby >= 3.2
45 SSLContext = Struct . new (
56 :store ,
67 :cacerts ,
@@ -9,22 +10,16 @@ module Puppet::SSL
910 :client_cert ,
1011 :client_chain ,
1112 :revocation ,
12- :verify_peer
13+ :verify_peer ,
14+ keyword_init : true
1315 ) 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?
2823 end
2924 end
3025end
You can’t perform that action at this time.
0 commit comments