@@ -61,7 +61,7 @@ def route_options_are_valid
6161 r [ :options ] . each_key do |key |
6262 RouteOptionsMessage . valid_route_options . exclude? ( key ) &&
6363 errors . add ( :base ,
64- message : "Route '#{ r [ :route ] } ' contains invalid route option '#{ key } '. \
64+ message : "Route '#{ r [ :route ] } ' contains invalid route option '#{ key } '. \
6565 Valid keys: '#{ RouteOptionsMessage . valid_route_options . join ( ', ' ) } '")
6666 end
6767 end
@@ -76,13 +76,13 @@ def loadbalancings_are_valid
7676 loadbalancing = r [ :options ] [ :loadbalancing ]
7777 unless loadbalancing . is_a? ( String )
7878 errors . add ( :base ,
79- message : "Invalid value for 'loadbalancing' for Route '#{ r [ :route ] } '; \
79+ message : "Invalid value for 'loadbalancing' for Route '#{ r [ :route ] } '; \
8080 Valid values are: '#{ RouteOptionsMessage . valid_loadbalancing_algorithms . join ( ', ' ) } '")
8181 next
8282 end
8383 RouteOptionsMessage . valid_loadbalancing_algorithms . exclude? ( loadbalancing ) &&
8484 errors . add ( :base ,
85- message : "Cannot use loadbalancing value '#{ loadbalancing } ' for Route '#{ r [ :route ] } '; \
85+ message : "Cannot use loadbalancing value '#{ loadbalancing } ' for Route '#{ r [ :route ] } '; \
8686 Valid values are: '#{ RouteOptionsMessage . valid_loadbalancing_algorithms . join ( ', ' ) } '")
8787 end
8888 end
@@ -106,12 +106,9 @@ def hash_options_are_valid
106106 hash_balance = options [ :hash_balance ]
107107
108108 # Validate hash_header length if present
109- if hash_header . present?
110- # Check length (at most 128 characters)
111- if hash_header . to_s . length > 128
112- errors . add ( :base , message : "Route '#{ r [ :route ] } ': Hash header must be at most 128 characters" )
113- next
114- end
109+ if hash_header . present? && ( hash_header . to_s . length > 128 )
110+ errors . add ( :base , message : "Route '#{ r [ :route ] } ': Hash header must be at most 128 characters" )
111+ next
115112 end
116113
117114 # Validate hash_balance is numeric if present
@@ -125,7 +122,7 @@ def hash_options_are_valid
125122 begin
126123 balance_float = Float ( hash_balance )
127124 # Must be either 0 or >= 1.1 and <= 10.0
128- unless balance_float == 0 || ( balance_float >= 1.1 && balance_float <= 10 )
125+ unless balance_float == 0 || balance_float . between? ( 1.1 , 10 )
129126 errors . add ( :base , message : "Route '#{ r [ :route ] } ': Hash balance must be either 0 or between to 1.1 and 10.0" )
130127 end
131128 rescue ArgumentError , TypeError
0 commit comments