Commit a856c39 Simon Humbert
committed
1 parent b6ec9cb commit a856c39 Copy full SHA for a856c39
File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -1393,22 +1393,24 @@ def insync?(is)
1393
1393
EOS
1394
1394
1395
1395
munge do |value |
1396
- match = value . to_s . match ( "([0-9]+)(-)?([0-9]+)?" )
1397
- low = match [ 1 ] . to_int
1398
- high = match [ 3 ] . to_int
1399
-
1400
- if low . nil? or ( low and match [ 2 ] and high . nil? )
1396
+ match = value . to_s . match ( "^([0-9]+)(-)?([0-9]+)?$" )
1397
+ if match . nil?
1401
1398
raise ArgumentError , "Length value must either be an integer or a range"
1402
1399
end
1403
1400
1404
- if ( low < 0 or low > 65535 )
1405
- or ( high and ( high < 0 or high > 65535 or high < low ) )
1401
+ low = match [ 1 ] . to_i
1402
+ if !match [ 3 ] . nil?
1403
+ high = match [ 3 ] . to_i
1404
+ end
1405
+
1406
+ if ( low < 0 or low > 65535 ) or \
1407
+ ( !high . nil? and ( high < 0 or high > 65535 or high < low ) )
1406
1408
raise ArgumentError , "Length values must be between 0 and 65535"
1407
1409
end
1408
1410
1409
- value = low
1410
- if high
1411
- value = value + ": #{ high } "
1411
+ value = low . to_s
1412
+ if ! high . nil?
1413
+ value << ":" << high . to_s
1412
1414
end
1413
1415
value
1414
1416
end
You can’t perform that action at this time.
0 commit comments