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
126
126
def self . default ; @default end
127
127
128
128
# 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
130
130
131
131
# A hash of hard-coded configurations, indexed by version number.
132
132
def self . version_defaults ; @version_defaults end
@@ -149,12 +149,11 @@ def self.version_defaults; @version_defaults end
149
149
#
150
150
# Given a config, returns that same config.
151
151
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
156
155
else
157
- version_defaults . fetch ( config ) {
156
+ version_defaults . fetch ( config ) do
158
157
case config
159
158
when Numeric
160
159
raise RangeError , "unknown config version: %p" % [ config ]
@@ -165,7 +164,7 @@ def self.[](config)
165
164
config . class , Config
166
165
]
167
166
end
168
- }
167
+ end
169
168
end
170
169
end
171
170
You can’t perform that action at this time.
0 commit comments