code-ruby 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/code/format.rb +18 -2
- data/lib/code/object/http.rb +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52e251b96064139d4e72a393de2b727b5d792ff0026d3d5f4830e582b54a7573
|
|
4
|
+
data.tar.gz: 456d6ddc2f99e1d662273af433beaf0461e960be102d829c26a9637af0c29bae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd013119d2df47feb3c438cee2dccb21e13a01ca319085f7a4dc012966efc02a21578b07ccd104e851f5a0d3c633ac45e07ffea4e7dc4ba34e4fd012fb9bbca8
|
|
7
|
+
data.tar.gz: 057ad7fc9b03bbe40e4c921833e0da2926c0dfb9688b5c63a389cb4e66a687354bebc9591fb95eb8f56f41785fac888d976964c950c88c5532646c164e35c9ed
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.2.
|
|
1
|
+
5.2.2
|
data/lib/code/format.rb
CHANGED
|
@@ -459,11 +459,12 @@ class Code
|
|
|
459
459
|
extract_string_concatenation_parts(left_operation: operation)
|
|
460
460
|
return format_string(merged_string, indent: indent) if merged_string
|
|
461
461
|
|
|
462
|
-
|
|
462
|
+
first_operator = format_operator(Array(operation[:others]).first&.fetch(:operator, ""))
|
|
463
|
+
expression = format_boolean_operand(operation[:first], first_operator, indent: indent)
|
|
463
464
|
|
|
464
465
|
Array(operation[:others]).each do |other|
|
|
465
|
-
right = format_nested_statement(other[:statement], indent: indent)
|
|
466
466
|
operator = format_operator(other[:operator])
|
|
467
|
+
right = format_boolean_operand(other[:statement], operator, indent: indent)
|
|
467
468
|
|
|
468
469
|
expression =
|
|
469
470
|
if compact_operator?(operator)
|
|
@@ -510,6 +511,21 @@ class Code
|
|
|
510
511
|
expression
|
|
511
512
|
end
|
|
512
513
|
|
|
514
|
+
def format_boolean_operand(statement, operator, indent:)
|
|
515
|
+
if BOOLEAN_WORD_OPERATORS.include?(operator) && statement.is_a?(Hash) &&
|
|
516
|
+
statement[:left_operation]
|
|
517
|
+
nested = Array(statement[:left_operation][:others])
|
|
518
|
+
if nested.any? do |other|
|
|
519
|
+
nested_operator = format_operator(other[:operator])
|
|
520
|
+
BOOLEAN_WORD_OPERATORS.include?(nested_operator) && nested_operator != operator
|
|
521
|
+
end
|
|
522
|
+
return format_group([statement], indent: indent)
|
|
523
|
+
end
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
format_nested_statement(statement, indent: indent)
|
|
527
|
+
end
|
|
528
|
+
|
|
513
529
|
def format_compact_receiver(expression, indent:)
|
|
514
530
|
return expression unless compact_receiver_needs_parentheses?(expression)
|
|
515
531
|
|
data/lib/code/object/http.rb
CHANGED
|
@@ -197,7 +197,8 @@ class Code
|
|
|
197
197
|
not_extended: 510,
|
|
198
198
|
network_authentication_required: 511
|
|
199
199
|
}.freeze
|
|
200
|
-
DEFAULT_TIMEOUT =
|
|
200
|
+
DEFAULT_TIMEOUT = 30
|
|
201
|
+
DEFAULT_OPEN_TIMEOUT = 10
|
|
201
202
|
MAX_HEADER_BYTES = 32.kilobytes
|
|
202
203
|
HEADER_NAME = /\A[A-Za-z0-9!#$%&'*+\-.^_`|~]+\z/
|
|
203
204
|
RESTRICTED_HEADERS = %w[
|
|
@@ -348,7 +349,7 @@ class Code
|
|
|
348
349
|
redirects =
|
|
349
350
|
(
|
|
350
351
|
if options.code_get("redirects").nothing?
|
|
351
|
-
|
|
352
|
+
0
|
|
352
353
|
else
|
|
353
354
|
options.code_get("redirects").raw
|
|
354
355
|
end
|
|
@@ -410,7 +411,11 @@ class Code
|
|
|
410
411
|
http.use_ssl = true if uri.scheme == "https"
|
|
411
412
|
http.max_retries = max_retries
|
|
412
413
|
default_timeout = http_timeout(timeout, DEFAULT_TIMEOUT)
|
|
413
|
-
open_timeout_value =
|
|
414
|
+
open_timeout_value =
|
|
415
|
+
http_timeout(
|
|
416
|
+
open_timeout,
|
|
417
|
+
timeout.nothing? ? DEFAULT_OPEN_TIMEOUT : default_timeout
|
|
418
|
+
)
|
|
414
419
|
read_timeout_value = http_timeout(read_timeout, default_timeout)
|
|
415
420
|
write_timeout_value = http_timeout(write_timeout, default_timeout)
|
|
416
421
|
|