File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ class Config
126126 def self . default ; @default end
127127
128128 # The global config object. Also available from Net::IMAP.config.
129- def self . global ; @global end
129+ def self . global ; @global if defined? ( @global ) end
130130
131131 # A hash of hard-coded configurations, indexed by version number.
132132 def self . version_defaults ; @version_defaults end
@@ -149,12 +149,11 @@ def self.version_defaults; @version_defaults end
149149 #
150150 # Given a config, returns that same config.
151151 def self . []( config )
152- if config . is_a? ( Config ) || config . nil? && global . nil?
153- config
154- elsif config . respond_to? ( :to_hash )
155- new ( global , **config ) . freeze
152+ if config . is_a? ( Config ) then config
153+ elsif config . nil? && global . nil? then nil
154+ elsif config . respond_to? ( :to_hash ) then new ( global , **config ) . freeze
156155 else
157- version_defaults . fetch ( config ) {
156+ version_defaults . fetch ( config ) do
158157 case config
159158 when Numeric
160159 raise RangeError , "unknown config version: %p" % [ config ]
@@ -165,7 +164,7 @@ def self.[](config)
165164 config . class , Config
166165 ]
167166 end
168- }
167+ end
169168 end
170169 end
171170
You can’t perform that action at this time.
0 commit comments