@@ -6,7 +6,10 @@ module Net
66 autoload :HTTP , 'net/http'
77end
88
9+ # rubocop:disable Style/OneClassPerFile
910module Utils
11+ # rubocop:enable Style/OneClassPerFile
12+
1013 extend self
1114
1215 # Used by #yamlify_command_events
@@ -212,7 +215,7 @@ def yamlify_command_events(events)
212215 # rubocop:disable Metrics
213216 def convert_operation_options ( options )
214217 if options
215- options . map do |k , v |
218+ options . filter_map do |k , v |
216219 out_v =
217220 case k
218221 when 'readPreference'
@@ -242,7 +245,7 @@ def convert_operation_options(options)
242245 # they mean is for the driver to use the default write concern,
243246 # which for Ruby means no write concern is specified at all.
244247 #
245- # This nil return requires the compact call below to get rid of
248+ # This nil return requires the filter_map call above to get rid of
246249 # the nils before outgoing options are constructed.
247250 next nil if v == { }
248251
@@ -255,7 +258,7 @@ def convert_operation_options(options)
255258 raise "Unhandled operation option #{ k } "
256259 end
257260 [ out_k , out_v ]
258- end . compact . to_h
261+ end . to_h
259262 else
260263 { }
261264 end
@@ -429,11 +432,11 @@ def wait_for_instance_profile
429432 begin
430433 ip = ec2_instance_profile
431434 if ip
432- puts "Instance profile assigned: #{ ip } "
435+ warn "Instance profile assigned: #{ ip } "
433436 break
434437 end
435438 rescue StandardError => e
436- puts "Problem retrieving instance profile: #{ e . class } : #{ e } "
439+ warn "Problem retrieving instance profile: #{ e . class } : #{ e } "
437440 end
438441
439442 if Process . clock_gettime ( Process ::CLOCK_MONOTONIC ) >= deadline
@@ -450,11 +453,11 @@ def wait_for_no_instance_profile
450453 begin
451454 ip = ec2_instance_profile
452455 if ip . nil?
453- puts 'Instance profile cleared'
456+ warn 'Instance profile cleared'
454457 break
455458 end
456459 rescue StandardError => e
457- puts "Problem retrieving instance profile: #{ e . class } : #{ e } "
460+ warn "Problem retrieving instance profile: #{ e . class } : #{ e } "
458461 end
459462
460463 if Process . clock_gettime ( Process ::CLOCK_MONOTONIC ) >= deadline
0 commit comments