json_mend 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c8f01b52f6eed3640e4be622b142646276e1253a33ec1404bc0c87415e01948
4
- data.tar.gz: bd40c8087d7a94795daff1a89b2cc3aab79df833bc35daf59d130e84ebd0af70
3
+ metadata.gz: cef80671ecf0296d0b0742bb94342c93a9cdf52e5def2ee4592a11f473ed6d6b
4
+ data.tar.gz: 831e6b821e39dff4adcf605e4f0beb53500ca846ac02a96e8c49e9822c7b1475
5
5
  SHA512:
6
- metadata.gz: 9f7ea495a91444ff58ae0f2dfa082c7b3ee6bc110bad0c2cef758f93c844edabfaff8622e15306f28b4fba8f440abc926f47728d9df6c0267c1039fab879b789
7
- data.tar.gz: 37493919d5d08baf3ae589070fb74105097c541363e6864e1b848d289642848f0e763ffd3d4a7ded437d2ccae793f933ce94e437fc3d90feb51d593c62425d46
6
+ metadata.gz: a43f2089605d476414103b4333fe7d248856f27d0a8589041d7826905c611619a18fe45841dcf8e97bdfae90cfb6718d39323d0839c8fe97dbb584a54db4712f
7
+ data.tar.gz: 65c72349a8a6b721ef0f1a077bb69f82fe36fb499aa30da57f36fbc0dddfd4a7129082ffc32f940569af876fa8f43d4f626507652f5480b06fc7717b648cf418
data/.rubocop.yml CHANGED
@@ -7,13 +7,13 @@ AllCops:
7
7
  SuggestExtensions: false
8
8
 
9
9
  Metrics/AbcSize:
10
- Max: 75
10
+ Max: 78
11
11
 
12
12
  Metrics/ClassLength:
13
13
  Max: 950
14
14
 
15
15
  Metrics/CyclomaticComplexity:
16
- Max: 35
16
+ Max: 36
17
17
 
18
18
  Metrics/MethodLength:
19
19
  Max: 85
@@ -581,7 +581,6 @@ module JsonMend
581
581
  )
582
582
  char = peek_char
583
583
  unmatched_delimiter = false
584
- safe_string_until = -1 # Fast-forward pointer to safely bypass O(N^2) lookaheads
585
584
  # --- Main Parsing Loop ---
586
585
  while !@scanner.eos? && char != rstring_delimiter
587
586
  # Fast-path for unquoted keys (e.g. { key: val })
@@ -600,33 +599,30 @@ module JsonMend
600
599
  missing_quotes:
601
600
  )
602
601
 
603
- # Bypass expensive comma/bracket checks because we already validated this segment extends to the next quote
604
- if @scanner.pos > safe_string_until
605
- if current_context?(:object_value) && TERMINATORS_OBJECT_VALUE.include?(char) &&
606
- (string_parts.empty? || string_parts.last != rstring_delimiter)
602
+ if current_context?(:object_value) && TERMINATORS_OBJECT_VALUE.include?(char) &&
603
+ (string_parts.empty? || string_parts.last != rstring_delimiter)
607
604
 
608
- is_break = check_rstring_delimiter_missing(
609
- string_parts:,
610
- lstring_delimiter:,
611
- rstring_delimiter:,
612
- missing_quotes:
613
- )
614
- break if is_break
615
- end
605
+ is_break = check_rstring_delimiter_missing(
606
+ string_parts:,
607
+ lstring_delimiter:,
608
+ rstring_delimiter:,
609
+ missing_quotes:
610
+ )
611
+ break if is_break
612
+ end
616
613
 
617
- if char == ']' && context_contain?(:array) && string_parts.last != rstring_delimiter
618
- i = skip_to_character(rstring_delimiter)
619
- # No delimiter found
620
- break unless peek_char(i)
621
- end
614
+ if char == ']' && context_contain?(:array) && string_parts.last != rstring_delimiter
615
+ i = skip_to_character(rstring_delimiter)
616
+ # No delimiter found
617
+ break unless peek_char(i)
618
+ end
622
619
 
623
- if current_context?(:object_value) && char == '}'
624
- # We found the end of an object while parsing a value
625
- # Check if the object is really over, to avoid doubling the closing brace
626
- i = skip_whitespaces_at(start_idx: 1)
627
- next_c = peek_char(i)
628
- break unless next_c
629
- end
620
+ if current_context?(:object_value) && char == '}'
621
+ # We found the end of an object while parsing a value
622
+ # Check if the object is really over, to avoid doubling the closing brace
623
+ i = skip_whitespaces_at(start_idx: 1)
624
+ next_c = peek_char(i)
625
+ break unless next_c
630
626
  end
631
627
 
632
628
  string_parts << char
@@ -644,7 +640,7 @@ module JsonMend
644
640
  end
645
641
 
646
642
  # If we are in object key context and we find a colon, it could be a missing right quote
647
- if @scanner.pos > safe_string_until && char == ':' && !missing_quotes && current_context?(:object_key)
643
+ if char == ':' && !missing_quotes && current_context?(:object_key)
648
644
  is_break = handle_missing_quotes_termination(
649
645
  lstring_delimiter:,
650
646
  rstring_delimiter:
@@ -670,8 +666,6 @@ module JsonMend
670
666
  string_parts << char.to_s
671
667
  @scanner.getch
672
668
  char = peek_char
673
-
674
- safe_string_until = @scanner.pos + skip_to_character(rstring_delimiter)
675
669
  end
676
670
  end
677
671
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonMend
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_mend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksii Vasyliev