@@ -528,12 +528,11 @@ def self.validate_and_massage_options(options)
528528 if options . key? ( :execution_profiles )
529529 options [ :execution_profiles ] . each do |name , profile |
530530 timeout = profile . timeout
531- unless timeout . nil?
532- Util . assert_instance_of ( ::Numeric , timeout ,
533- ":timeout of execution profile #{ name } must be a number of seconds, " \
534- "#{ timeout . inspect } given" )
535- Util . assert ( timeout > 0 , ":timeout of execution profile #{ name } must be greater than 0, #{ timeout } given" )
536- end
531+ next if timeout . nil?
532+ Util . assert_instance_of ( ::Numeric , timeout ,
533+ ":timeout of execution profile #{ name } must be a number of seconds, " \
534+ "#{ timeout . inspect } given" )
535+ Util . assert ( timeout > 0 , ":timeout of execution profile #{ name } must be greater than 0, #{ timeout } given" )
537536 end
538537 end
539538
@@ -599,12 +598,11 @@ def self.validate_and_massage_options(options)
599598 :distance , :plan ]
600599 options [ :execution_profiles ] . each do |name , profile |
601600 load_balancing_policy = profile . load_balancing_policy
602- unless load_balancing_policy . nil?
603- Util . assert_responds_to_all ( methods , load_balancing_policy ,
604- ":load_balancing_policy in execution profile #{ name } #{ load_balancing_policy . inspect } must respond " \
605- "to #{ methods . inspect } , but doesn't"
606- )
607- end
601+ next if load_balancing_policy . nil?
602+ Util . assert_responds_to_all ( methods , load_balancing_policy ,
603+ ":load_balancing_policy in execution profile #{ name } " \
604+ "#{ load_balancing_policy . inspect } must respond " \
605+ "to #{ methods . inspect } , but doesn't" )
608606 end
609607 end
610608
@@ -629,12 +627,10 @@ def self.validate_and_massage_options(options)
629627 methods = [ :read_timeout , :write_timeout , :unavailable ]
630628 options [ :execution_profiles ] . each do |name , profile |
631629 retry_policy = profile . retry_policy
632- unless retry_policy . nil?
633- Util . assert_responds_to_all ( methods , retry_policy ,
634- ":retry_policy in execution profile #{ name } #{ retry_policy . inspect } must " \
635- "respond to #{ methods . inspect } , but doesn't"
636- )
637- end
630+ next if retry_policy . nil?
631+ Util . assert_responds_to_all ( methods , retry_policy ,
632+ ":retry_policy in execution profile #{ name } #{ retry_policy . inspect } must " \
633+ "respond to #{ methods . inspect } , but doesn't" )
638634 end
639635 end
640636
@@ -643,19 +639,16 @@ def self.validate_and_massage_options(options)
643639 if options . key? ( :consistency )
644640 consistency = options [ :consistency ]
645641 Util . assert_one_of ( CONSISTENCIES , consistency ,
646- ":consistency must be one of #{ CONSISTENCIES . inspect } , " \
647- "#{ consistency . inspect } given"
648- )
642+ ":consistency must be one of #{ CONSISTENCIES . inspect } , " \
643+ "#{ consistency . inspect } given" )
649644 end
650645 if options . key? ( :execution_profiles )
651646 options [ :execution_profiles ] . each do |name , profile |
652647 consistency = profile . consistency
653- unless consistency . nil?
654- Util . assert_one_of ( CONSISTENCIES , consistency ,
655- ":consistency in execution profile #{ name } must be one of #{ CONSISTENCIES . inspect } , " \
656- "#{ consistency . inspect } given"
657- )
658- end
648+ next if consistency . nil?
649+ Util . assert_one_of ( CONSISTENCIES , consistency ,
650+ ":consistency in execution profile #{ name } must be one of #{ CONSISTENCIES . inspect } , " \
651+ "#{ consistency . inspect } given" )
659652 end
660653 end
661654
@@ -681,9 +674,8 @@ def self.validate_and_massage_options(options)
681674 unless protocol_version . nil?
682675 Util . assert_instance_of ( ::Integer , protocol_version )
683676 Util . assert_one_of ( 1 ..Cassandra ::Protocol ::Versions ::MAX_SUPPORTED_VERSION , protocol_version ,
684- ':protocol_version must be a positive integer between 1 and ' \
685- "#{ Cassandra ::Protocol ::Versions ::MAX_SUPPORTED_VERSION } , #{ protocol_version . inspect } given"
686- )
677+ ':protocol_version must be a positive integer between 1 and ' \
678+ "#{ Cassandra ::Protocol ::Versions ::MAX_SUPPORTED_VERSION } , #{ protocol_version . inspect } given" )
687679 end
688680 end
689681
0 commit comments