We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9705844 commit b28a17bCopy full SHA for b28a17b
lib/net/imap/config.rb
@@ -161,6 +161,23 @@ def update(**attrs)
161
self
162
end
163
164
+ # :call-seq:
165
+ # with(**attrs) -> config
166
+ # with(**attrs) {|config| } -> result
167
+ #
168
+ # Returns a shallow copy of +self+. When provided with a block, yields
169
+ # the copy to the block and returns the block's result.
170
171
+ # If any keyword arguments are given, the copy will be updated with their
172
+ # values.
173
174
+ # If +self+ is frozen, the copy will also be frozen.
175
+ def with(**attrs)
176
+ copy = dup.update(**attrs)
177
+ copy.freeze if frozen?
178
+ block_given? ? yield(copy) : copy
179
+ end
180
+
181
# :call-seq: to_h -> hash
182
#
183
# Returns all config attributes in a hash.
0 commit comments