json_p3 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: 2d20426353cc6a3b8f7be130f6b5d3dd8ff37dcad13ac2b81a7a421f70d0462c
4
- data.tar.gz: c93805a6ca467e830881176da0b9203bf3cfce7d85690749621bf3609de43e1c
3
+ metadata.gz: 58f9239b2c34d2ad4b9bcd724f19cd2e6daab881befb2b568d44065ab3378864
4
+ data.tar.gz: a76e4a183e830bbfab1f925efde9e9e6e4fb36b2687c13ab0c85b609b01b5baf
5
5
  SHA512:
6
- metadata.gz: 329b8946de0220d55a7d1358bfd3062bced99420247b14d95ec023ab7fbb22a336534d227ebbf37766890f2c2c68bf5dc482504e10860b12845830930c560d5f
7
- data.tar.gz: d248901e8c95aaa4ca7336d56439542cb4c6208c94993a6324e48b9dcbf95c00ed84040f36d697c99fe8b629e48c58f5c01bd0d55a6e8eac2ffa2af23ce06779
6
+ metadata.gz: c36a725f0856cfa9e2c8f91931a008db812dfd17b3d4ad1afad59cddf56afac0c91ad221d258950a2a755ffa988cef8ee0f5cf43f08ca0eccbf3c3be7facdf4f
7
+ data.tar.gz: a17d419c6dbd96c15596052eaf12b0615725590b5e448d33ffc48e44082d95011ea3f119e0c2529b871c7be16ded8d5c7c1296c3479c03bc16c8e81d2ce33034
checksums.yaml.gz.sig CHANGED
Binary file
data/.rubocop.yml CHANGED
@@ -23,7 +23,7 @@ Metrics/CyclomaticComplexity:
23
23
  Max: 15
24
24
 
25
25
  Metrics/MethodLength:
26
- Max: 35
26
+ Max: 50
27
27
 
28
28
  Metrics/PerceivedComplexity:
29
29
  Max: 20
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.3.1] - 2024-12-05
2
+
3
+ - Fix JSON Patch `move` and `copy` operations when using the special JSON Pointer token `-`.
4
+
1
5
  ## [0.3.0] - 2024-11-25
2
6
 
3
7
  - Implement JSON Pointer and Relative JSON Pointer
data/README.md CHANGED
@@ -474,6 +474,12 @@ Print memory usage to the terminal.
474
474
  bundle exec ruby performance/memory_profile.rb
475
475
  ```
476
476
 
477
- ### TruffleRuby
477
+ ### Notes to self
478
+
479
+ #### Build
480
+
481
+ `bundle exec rake release` and `bundle exec rake build` will look for `gem-private_key.pem` and `gem-public_cert.pem` in `~/.gem`.
482
+
483
+ #### TruffleRuby
478
484
 
479
485
  On macOS Sonoma using MacPorts and `rbenv`, `LIBYAML_PREFIX=/opt/local/lib` is needed to install TruffleRuby and when executing any `bundle` command.
@@ -116,7 +116,7 @@ module JSONP3
116
116
  end
117
117
  end
118
118
 
119
- def parse_bracketed_selection(stream) # rubocop:disable Metrics/MethodLength
119
+ def parse_bracketed_selection(stream)
120
120
  stream.expect(:token_lbracket)
121
121
  segment_token = stream.next
122
122
 
@@ -245,7 +245,7 @@ module JSONP3
245
245
  FilterSelector.new(@env, token, FilterExpression.new(token, expression))
246
246
  end
247
247
 
248
- def parse_filter_expression(stream, precedence = Precedence::LOWEST) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
248
+ def parse_filter_expression(stream, precedence = Precedence::LOWEST) # rubocop:disable Metrics/CyclomaticComplexity
249
249
  left = case stream.peek.type
250
250
  when :token_double_quote_string, :token_single_quote_string
251
251
  token = stream.next
@@ -313,7 +313,7 @@ module JSONP3
313
313
  end
314
314
  end
315
315
 
316
- def parse_function_expression(stream) # rubocop:disable Metrics/MethodLength
316
+ def parse_function_expression(stream)
317
317
  token = stream.next
318
318
  args = [] # : Array[Expression]
319
319
 
data/lib/json_p3/patch.rb CHANGED
@@ -220,7 +220,11 @@ module JSONP3
220
220
 
221
221
  # Write the source value to the destination.
222
222
  if dest_parent.is_a?(Array)
223
- dest_parent[dest_target.to_i] = source_obj
223
+ if dest_target == "-"
224
+ dest_parent << source_obj
225
+ else
226
+ dest_parent[dest_target.to_i] = source_obj
227
+ end
224
228
  elsif dest_parent.is_a?(Hash)
225
229
  dest_parent[dest_target] = source_obj
226
230
  end
@@ -267,7 +271,11 @@ module JSONP3
267
271
 
268
272
  # Write the source value to the destination.
269
273
  if dest_parent.is_a?(Array)
270
- dest_parent.insert(dest_target.to_i, deep_copy(source_obj))
274
+ if dest_target == "-"
275
+ dest_parent << source_obj
276
+ else
277
+ dest_parent.insert(dest_target.to_i, deep_copy(source_obj))
278
+ end
271
279
  elsif dest_parent.is_a?(Hash)
272
280
  dest_parent[dest_target] = deep_copy(source_obj)
273
281
  else
@@ -6,7 +6,7 @@ module JSONP3 # rubocop:disable Style/Documentation
6
6
  # @param quote [String] one of '"' or "'".
7
7
  # @param token [Token]
8
8
  # @return [String] A new string without escape sequences.
9
- def self.unescape_string(value, quote, token) # rubocop:disable Metrics/MethodLength
9
+ def self.unescape_string(value, quote, token)
10
10
  unescaped = String.new(encoding: "UTF-8")
11
11
  index = 0
12
12
  length = value.length
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONP3
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_p3
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
  - James Prior
@@ -36,7 +36,7 @@ cert_chain:
36
36
  6dM18fnfBc3yA4KI7AO8UAmRkTscMYV6f/K4YZR6ZYCNWRpY7rkg+arhf05aoSQf
37
37
  vn9bO1bzwdnG
38
38
  -----END CERTIFICATE-----
39
- date: 2024-11-25 00:00:00.000000000 Z
39
+ date: 2024-12-05 00:00:00.000000000 Z
40
40
  dependencies: []
41
41
  description: JSONPath following RFC 9535
42
42
  email:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.5.16
109
+ rubygems_version: 3.3.27
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: 'JSONPath: Query Expressions for JSON in Ruby'
metadata.gz.sig CHANGED
Binary file