json_p3 0.2.1 → 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.
@@ -70,7 +70,7 @@ module JSONP3
70
70
  @sym = @name.to_sym
71
71
  end
72
72
 
73
- def resolve(node) # rubocop:disable Metrics/MethodLength
73
+ def resolve(node)
74
74
  if node.value.is_a?(Hash)
75
75
  if node.value.key?(@name)
76
76
  [node.new_child(node.value[@name], @name)]
@@ -172,7 +172,7 @@ module JSONP3
172
172
  @step = step || 1
173
173
  end
174
174
 
175
- def resolve(node) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
175
+ def resolve(node)
176
176
  return [] unless node.value.is_a?(Array)
177
177
 
178
178
  length = node.value.length
@@ -248,8 +248,8 @@ module JSONP3
248
248
  @expression = expression
249
249
  end
250
250
 
251
- def resolve(node) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
252
- nodes = []
251
+ def resolve(node)
252
+ nodes = [] # : Array[JSONPathNode]
253
253
 
254
254
  if node.value.is_a?(Array)
255
255
  node.value.each_with_index do |e, i|
data/lib/json_p3/token.rb CHANGED
@@ -7,44 +7,6 @@ module JSONP3
7
7
  # string from a JSONPath expression, its location within the JSONPath expression and a
8
8
  # symbol indicating what type of token it is.
9
9
  class Token
10
- EOI = :token_eoi
11
- ERROR = :token_error
12
-
13
- SHORTHAND_NAME = :token_shorthand_name
14
- COLON = :token_colon
15
- COMMA = :token_comma
16
- DOT = :token_dot
17
- DOUBLE_DOT = :token_double_dot
18
- FILTER = :token_filter
19
- INDEX = :token_index
20
- LBRACKET = :token_lbracket
21
- NAME = :token_name
22
- RBRACKET = :token_rbracket
23
- ROOT = :token_root
24
- WILD = :token_wild
25
-
26
- AND = :token_and
27
- CURRENT = :token_current
28
- DOUBLE_QUOTE_STRING = :token_double_quote_string
29
- EQ = :token_eq
30
- FALSE = :token_false
31
- FLOAT = :token_float
32
- FUNCTION = :token_function
33
- GE = :token_ge
34
- GT = :token_gt
35
- INT = :token_int
36
- LE = :token_le
37
- LPAREN = :token_lparen
38
- LT = :token_lt
39
- NE = :token_ne
40
- NOT = :token_not
41
- NULL = :token_null
42
- OP = :token_op
43
- OR = :token_or
44
- RPAREN = :token_rparen
45
- SINGLE_QUOTE_STRING = :token_single_quote_string
46
- TRUE = :token_true
47
-
48
10
  # @dynamic type, value, start, query, message
49
11
  attr_reader :type, :value, :start, :query, :message
50
12
 
@@ -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, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
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
@@ -51,13 +51,13 @@ module JSONP3 # rubocop:disable Style/Documentation
51
51
  unescaped
52
52
  end
53
53
 
54
- def self.decode_hex_char(value, index, token) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
54
+ def self.decode_hex_char(value, index, token)
55
55
  length = value.length
56
56
 
57
57
  raise JSONPathSyntaxError.new("incomplete escape sequence", token) if index + 4 >= length
58
58
 
59
59
  index += 1 # move past 'u'
60
- code_point = parse_hex_digits(value[index...index + 4], token)
60
+ code_point = parse_hex_digits(value[index, 4], token)
61
61
 
62
62
  raise JSONPathSyntaxError.new("unexpected low surrogate", token) if low_surrogate?(code_point)
63
63
 
@@ -67,7 +67,7 @@ module JSONP3 # rubocop:disable Style/Documentation
67
67
  raise JSONPathSyntaxError.new("incomplete escape sequence", token)
68
68
  end
69
69
 
70
- low_surrogate = parse_hex_digits(value[index + 6...index + 10], token)
70
+ low_surrogate = parse_hex_digits(value[index + 6, 10], token)
71
71
 
72
72
  raise JSONPathSyntaxError.new("unexpected low surrogate", token) unless low_surrogate?(low_surrogate)
73
73
 
@@ -78,7 +78,7 @@ module JSONP3 # rubocop:disable Style/Documentation
78
78
  [code_point, index + 9]
79
79
  end
80
80
 
81
- def self.parse_hex_digits(digits, token) # rubocop:disable Metrics/MethodLength
81
+ def self.parse_hex_digits(digits, token)
82
82
  code_point = 0
83
83
  digits.each_byte do |b|
84
84
  code_point <<= 4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONP3
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.1"
5
5
  end
data/lib/json_p3.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require_relative "json_p3/version"
4
4
  require_relative "json_p3/environment"
5
+ require_relative "json_p3/pointer"
6
+ require_relative "json_p3/patch"
5
7
 
6
8
  # RFC 9535 JSONPath query expressions for JSON.
7
9
  module JSONP3
@@ -14,4 +16,12 @@ module JSONP3
14
16
  def self.compile(path)
15
17
  DefaultEnvironment.compile(path)
16
18
  end
19
+
20
+ def self.resolve(pointer, value, default: JSONPointer::UNDEFINED)
21
+ JSONPointer.new(pointer).resolve(value, default: default)
22
+ end
23
+
24
+ def self.apply(ops, value)
25
+ JSONPatch.new(ops).apply(value)
26
+ end
17
27
  end
data/sig/json_p3.rbs CHANGED
@@ -1,16 +1,20 @@
1
- # RFC 9535 JSONPath query expressions for JSON.
1
+ # JSONPath, JSON Patch and JSON Pointer for Ruby
2
2
  module JSONP3
3
3
  DefaultEnvironment: JSONPathEnvironment
4
4
 
5
5
  def self.find: (String path, untyped data) -> JSONPathNodeList
6
6
 
7
7
  def self.compile: (String path) -> JSONPath
8
+
9
+ def self.resolve: (String pointer, untyped value, ?default: untyped) -> untyped
10
+
11
+ def self.apply: (Array[Op | Hash[String, untyped]] ops, untyped value) -> untyped
8
12
  end
9
13
 
10
14
  module JSONP3
11
15
  # A least recently used cache relying on Ruby hash insertion order.
12
16
  class LRUCache
13
- @data: untyped
17
+ @data: Hash[untyped, untyped]
14
18
 
15
19
  @max_size: Integer
16
20
 
@@ -91,6 +95,25 @@ module JSONP3
91
95
 
92
96
  class JSONPathRecursionError < JSONPathError
93
97
  end
98
+
99
+ class JSONPointerError < StandardError
100
+ end
101
+
102
+ class JSONPointerIndexError < JSONPointerError
103
+ end
104
+
105
+ class JSONPointerSyntaxError < JSONPointerError
106
+ end
107
+
108
+ class JSONPointerTypeError < JSONPointerError
109
+ end
110
+
111
+ class JSONPatchError < StandardError
112
+ end
113
+
114
+ class JSONPatchTestFailure < JSONPatchError
115
+ end
116
+
94
117
  end
95
118
 
96
119
  module JSONP3
@@ -333,7 +356,7 @@ module JSONP3
333
356
 
334
357
  def self.lt?: (Expression left, Expression right) -> bool
335
358
 
336
- # Contextural information and data used for evaluating a filter expression.
359
+ # Contextual information and data used for evaluating a filter expression.
337
360
  class FilterContext
338
361
  @env: JSONPathEnvironment
339
362
 
@@ -351,20 +374,14 @@ module JSONP3
351
374
  end
352
375
  end
353
376
 
354
- module JSONP3
355
- class ExpressionType
356
- VALUE: :value_expression
357
-
358
- LOGICAL: :logical_expression
359
-
360
- NODES: :nodes_expression
361
- end
377
+ type expression_t = :value_expression | :logical_expression | :nodes_expression
362
378
 
379
+ module JSONP3
363
380
  # Base class for all filter functions.
364
381
  class FunctionExtension
365
- ARG_TYPES: ::Array[Symbol]
382
+ ARG_TYPES: Array[expression_t]
366
383
 
367
- RETURN_TYPE: Symbol
384
+ RETURN_TYPE: expression_t
368
385
 
369
386
  def call: (*untyped _args, **untyped _kwargs) -> untyped
370
387
  end
@@ -412,7 +429,7 @@ module JSONP3
412
429
  # @param token_type [Symbol] one of the constants defined on the _Token_ class.
413
430
  # @param value [String | nil] a the token's value, if it is known, otherwise the
414
431
  # value will be sliced from @query. This is a performance optimisation.
415
- def emit: (Symbol token_type, ?untyped value) -> void
432
+ def emit: (token_t token_type, ?untyped value) -> void
416
433
 
417
434
  def next: () -> String
418
435
 
@@ -445,7 +462,7 @@ module JSONP3
445
462
 
446
463
  def lex_inside_filter: () -> untyped
447
464
 
448
- def self.lex_string_factory: (String quote, Symbol state, Symbol token) -> untyped
465
+ def self.lex_string_factory: (String quote, Symbol state, token_t token) -> untyped
449
466
  end
450
467
  end
451
468
 
@@ -507,9 +524,9 @@ module JSONP3
507
524
 
508
525
  def peek: () -> Token
509
526
 
510
- def expect: (Symbol token_type) -> void
527
+ def expect: (token_t token_type) -> void
511
528
 
512
- def expect_not: (Symbol token_type, String message) -> void
529
+ def expect_not: (token_t token_type, String message) -> void
513
530
 
514
531
  def to_s: () -> ::String
515
532
  end
@@ -577,15 +594,15 @@ module JSONP3
577
594
 
578
595
  def raise_for_non_comparable_function: (Expression expression) -> void
579
596
 
580
- def raise_for_uncompared_literal: (Expression expression) -> void
597
+ def raise_for_not_compared_literal: (Expression expression) -> void
581
598
 
582
599
  def validate_function_extension_signature: (Token token, untyped args) -> void
583
600
 
584
- def function_return_type: (Expression expression) -> (Symbol | nil)
601
+ def function_return_type: (Expression expression) -> (expression_t | nil)
585
602
 
586
- PRECEDENCES: ::Hash[Symbol, Integer]
603
+ PRECEDENCES: ::Hash[token_t, Integer]
587
604
 
588
- BINARY_OPERATORS: ::Hash[Symbol, "&&" | "||" | "==" | ">=" | ">" | "<=" | "<" | "!="]
605
+ BINARY_OPERATORS: ::Hash[token_t, "&&" | "||" | "==" | ">=" | ">" | "<=" | "<" | "!="]
589
606
 
590
607
  COMPARISON_OPERATORS: Set[String]
591
608
  end
@@ -828,12 +845,48 @@ module JSONP3
828
845
  end
829
846
  end
830
847
 
848
+ type token_t = (
849
+ :token_eoi |
850
+ :token_error |
851
+ :token_colon |
852
+ :token_comma |
853
+ :token_double_dot |
854
+ :token_filter |
855
+ :token_index |
856
+ :token_lbracket |
857
+ :token_name |
858
+ :token_rbracket |
859
+ :token_root |
860
+ :token_wild |
861
+ :token_and |
862
+ :token_current |
863
+ :token_double_quote_string |
864
+ :token_eq |
865
+ :token_false |
866
+ :token_float |
867
+ :token_function |
868
+ :token_ge |
869
+ :token_gt |
870
+ :token_int |
871
+ :token_le |
872
+ :token_lparen |
873
+ :token_lt |
874
+ :token_ne |
875
+ :token_not |
876
+ :token_null |
877
+ :token_or |
878
+ :token_rparen |
879
+ :token_single_quote_string |
880
+ :token_true
881
+ )
882
+
883
+
831
884
  module JSONP3
832
885
  # Tokens are produced by the lexer and consumed by the parser. Each token contains sub
833
886
  # string from a JSONPath expression, its location within the JSONPath expression and a
834
887
  # symbol indicating what type of token it is.
835
888
  class Token
836
- @type: Symbol
889
+ @type: token_t
837
890
 
838
891
  @value: String
839
892
 
@@ -843,78 +896,8 @@ module JSONP3
843
896
 
844
897
  @message: (String | nil)
845
898
 
846
- EOI: :token_eoi
847
-
848
- ERROR: :token_error
849
-
850
- SHORTHAND_NAME: :token_shorthand_name
851
-
852
- COLON: :token_colon
853
-
854
- COMMA: :token_comma
855
-
856
- DOT: :token_dot
857
-
858
- DOUBLE_DOT: :token_double_dot
859
-
860
- FILTER: :token_filter
861
-
862
- INDEX: :token_index
863
-
864
- LBRACKET: :token_lbracket
865
-
866
- NAME: :token_name
867
-
868
- RBRACKET: :token_rbracket
869
-
870
- ROOT: :token_root
871
-
872
- WILD: :token_wild
873
-
874
- AND: :token_and
875
-
876
- CURRENT: :token_current
877
-
878
- DOUBLE_QUOTE_STRING: :token_double_quote_string
879
-
880
- EQ: :token_eq
881
-
882
- FALSE: :token_false
883
-
884
- FLOAT: :token_float
885
-
886
- FUNCTION: :token_function
887
-
888
- GE: :token_ge
889
-
890
- GT: :token_gt
891
-
892
- INT: :token_int
893
-
894
- LE: :token_le
895
-
896
- LPAREN: :token_lparen
897
-
898
- LT: :token_lt
899
-
900
- NE: :token_ne
901
-
902
- NOT: :token_not
903
-
904
- NULL: :token_null
905
-
906
- OP: :token_op
907
-
908
- OR: :token_or
909
-
910
- RPAREN: :token_rparen
911
-
912
- SINGLE_QUOTE_STRING: :token_single_quote_string
913
-
914
- TRUE: :token_true
915
-
916
899
  # @dynamic type, value, start, query
917
- attr_reader type: Symbol
900
+ attr_reader type: token_t
918
901
 
919
902
  # @dynamic type, value, start, query
920
903
  attr_reader value: String
@@ -928,7 +911,7 @@ module JSONP3
928
911
  # @dynamic type, value, start, query
929
912
  attr_reader message: (String | nil)
930
913
 
931
- def initialize: (Symbol type, String value, Integer start, String query, ?message: (String | nil)?) -> void
914
+ def initialize: (token_t type, String value, Integer start, String query, ?message: (String | nil)?) -> void
932
915
 
933
916
  def ==: (untyped other) -> bool
934
917
 
@@ -964,9 +947,9 @@ end
964
947
  module JSONP3
965
948
  # The standard `count` function.
966
949
  class Count < FunctionExtension
967
- ARG_TYPES: ::Array[Symbol]
950
+ ARG_TYPES: Array[expression_t]
968
951
 
969
- RETURN_TYPE: Symbol
952
+ RETURN_TYPE: expression_t
970
953
 
971
954
  def call: (JSONPathNodeList node_list) -> untyped
972
955
  end
@@ -975,9 +958,9 @@ end
975
958
  module JSONP3
976
959
  # The standard `length` function.
977
960
  class Length < FunctionExtension
978
- ARG_TYPES: ::Array[Symbol]
961
+ ARG_TYPES: Array[expression_t]
979
962
 
980
- RETURN_TYPE: Symbol
963
+ RETURN_TYPE: expression_t
981
964
 
982
965
  def call: (untyped obj) -> (:nothing | untyped)
983
966
  end
@@ -992,9 +975,9 @@ module JSONP3
992
975
 
993
976
  @cache: LRUCache
994
977
 
995
- ARG_TYPES: ::Array[Symbol]
978
+ ARG_TYPES: Array[expression_t]
996
979
 
997
- RETURN_TYPE: Symbol
980
+ RETURN_TYPE: expression_t
998
981
 
999
982
  # @param cache_size [Integer] the maximum size of the regexp cache. Set it to
1000
983
  # zero or negative to disable the cache.
@@ -1029,9 +1012,9 @@ module JSONP3
1029
1012
 
1030
1013
  @cache: LRUCache
1031
1014
 
1032
- ARG_TYPES: ::Array[Symbol]
1015
+ ARG_TYPES: Array[expression_t]
1033
1016
 
1034
- RETURN_TYPE: Symbol
1017
+ RETURN_TYPE: expression_t
1035
1018
 
1036
1019
  # @param cache_size [Integer] the maximum size of the regexp cache. Set it to
1037
1020
  # zero or negative to disable the cache.
@@ -1049,10 +1032,245 @@ end
1049
1032
  module JSONP3
1050
1033
  # The standard `value` function.
1051
1034
  class Value < FunctionExtension
1052
- ARG_TYPES: ::Array[Symbol]
1035
+ ARG_TYPES: Array[expression_t]
1053
1036
 
1054
- RETURN_TYPE: Symbol
1037
+ RETURN_TYPE: expression_t
1055
1038
 
1056
1039
  def call: (JSONPathNodeList node_list) -> (untyped | :nothing)
1057
1040
  end
1058
1041
  end
1042
+
1043
+ module JSONP3
1044
+ # Identify a single value in JSON-like data, as per RFC 6901.
1045
+ class JSONPointer
1046
+ @tokens: Array[String | Integer]
1047
+
1048
+ @pointer: String
1049
+
1050
+ UNDEFINED: :__undefined
1051
+
1052
+ RE_INT: ::Regexp
1053
+
1054
+ attr_reader tokens: Array[String | Integer]
1055
+
1056
+ # Encode an array of strings and integers into a JSON pointer.
1057
+ # @param tokens [Array<String | Integer>]
1058
+ # @return [String]
1059
+ def self.encode: (Array[String | Integer] tokens) -> String
1060
+
1061
+ # @param pointer [String]
1062
+ def initialize: (String pointer) -> void
1063
+
1064
+ # Resolve this pointer against JSON-like data _value_.
1065
+ def resolve: (untyped value, ?default: untyped) -> untyped
1066
+
1067
+ def resolve_with_parent: (untyped value) -> ::Array[untyped]
1068
+
1069
+ def relative_to?: (JSONPointer pointer) -> bool
1070
+
1071
+ # @param parts [String]
1072
+ def join: (*String parts) -> JSONPointer
1073
+
1074
+ # Return _true_ if this pointer can be resolved against _value_, even if the resolved
1075
+ # value is false or nil.
1076
+ def exist?: (untyped value) -> bool
1077
+
1078
+ # Return this pointer's parent as a new pointer. If this pointer points to the
1079
+ # document root, self is returned.
1080
+ def parent: () -> JSONPointer
1081
+
1082
+ # @param rel [String | RelativeJSONPointer]
1083
+ # @return [JSONPointer]
1084
+ def to: ((String | RelativeJSONPointer) rel) -> JSONPointer
1085
+
1086
+ def to_s: () -> String
1087
+
1088
+ # @param pointer [String]
1089
+ # @return [Array<String | Integer>]
1090
+ def parse: (String pointer) -> Array[(String | Integer)]
1091
+
1092
+ # @param value [Object]
1093
+ # @param token [String | Integer]
1094
+ # @return [Object] the "fetched" object from _value_ or UNDEFINED.
1095
+ def get_item: (untyped value, (String | Integer) token) -> untyped
1096
+
1097
+ # Like `#parse`, but assumes there's no leading slash.
1098
+ # @param pointer [String]
1099
+ # @return [Array<String | Integer>]
1100
+ def _parse: (String pointer) -> Array[(String | Integer)]
1101
+
1102
+ def _join: (String other) -> JSONPointer
1103
+ end
1104
+
1105
+ # A relative JSON Pointer.
1106
+ # See https://datatracker.ietf.org/doc/html/draft-hha-relative-json-pointer
1107
+ class RelativeJSONPointer
1108
+ @origin: Integer
1109
+
1110
+ @index: Integer
1111
+
1112
+ @pointer: (String | JSONPointer)
1113
+
1114
+ RE_RELATIVE_POINTER: ::Regexp
1115
+
1116
+ RE_INT: ::Regexp
1117
+
1118
+ # @param rel [String]
1119
+ def initialize: (String rel) -> void
1120
+
1121
+ def to_s: () -> ::String
1122
+
1123
+ # @param pointer [String | JSONPointer]
1124
+ # @return [JSONPointer]
1125
+ def to: ((String | JSONPointer) pointer) -> JSONPointer
1126
+
1127
+ private
1128
+
1129
+ # @param token [String]
1130
+ # @return [Integer]
1131
+ def parse_int: (String token) -> Integer
1132
+ end
1133
+ end
1134
+
1135
+ module JSONP3
1136
+ # Base class for all JSON Patch operations
1137
+ class Op
1138
+ # Return the name of the patch operation.
1139
+ def name: () -> String
1140
+
1141
+ # Apply the patch operation to _value_.
1142
+ def apply: (untyped _value, Integer _index) -> untyped
1143
+
1144
+ # Return a JSON-like representation of this patch operation.
1145
+ def to_h: () -> untyped
1146
+ end
1147
+
1148
+ # The JSON Patch _add_ operation.
1149
+ class OpAdd < Op
1150
+ @pointer: JSONPointer
1151
+
1152
+ @value: untyped
1153
+
1154
+ # @param pointer [JSONPointer]
1155
+ # @param value [JSON-like value]
1156
+ def initialize: (JSONPointer pointer, untyped value) -> void
1157
+
1158
+ def name: () -> "add"
1159
+ end
1160
+
1161
+ # The JSON Patch _remove_ operation.
1162
+ class OpRemove < Op
1163
+ @pointer: JSONPointer
1164
+
1165
+ # @param papointerth [JSONPointer]
1166
+ def initialize: (JSONPointer pointer) -> void
1167
+
1168
+ def name: () -> "remove"
1169
+ end
1170
+
1171
+ # The JSON Patch _replace_ operation.
1172
+ class OpReplace < Op
1173
+ @pointer: JSONPointer
1174
+
1175
+ @value: untyped
1176
+
1177
+ # @param pointer [JSONPointer]
1178
+ # @param value [JSON-like value]
1179
+ def initialize: (JSONPointer pointer, untyped value) -> void
1180
+
1181
+ def name: () -> "replace"
1182
+ end
1183
+
1184
+ # The JSON Patch _move_ operation.
1185
+ class OpMove < Op
1186
+ @from: JSONPointer
1187
+
1188
+ @pointer: JSONPointer
1189
+
1190
+ # @param from [JSONPointer]
1191
+ # @param pointer [JSONPointer]
1192
+ def initialize: (JSONPointer from, JSONPointer pointer) -> void
1193
+
1194
+ def name: () -> "move"
1195
+ end
1196
+
1197
+ # The JSON Patch _copy_ operation.
1198
+ class OpCopy < Op
1199
+ @from: JSONPointer
1200
+
1201
+ @pointer: JSONPointer
1202
+
1203
+ # @param from [JSONPointer]
1204
+ # @param pointer [JSONPointer]
1205
+ def initialize: (JSONPointer from, JSONPointer pointer) -> void
1206
+
1207
+ def name: () -> "copy"
1208
+
1209
+ def deep_copy: (untyped obj) -> untyped
1210
+ end
1211
+
1212
+ # The JSON Patch _test_ operation.
1213
+ class OpTest < Op
1214
+ @pointer: JSONPointer
1215
+
1216
+ @value: untyped
1217
+
1218
+ # @param pointer [JSONPointer]
1219
+ # @param value [JSON-like value]
1220
+ def initialize: (JSONPointer pointer, untyped value) -> void
1221
+
1222
+ def name: () -> "test"
1223
+ end
1224
+
1225
+ # A JSON Patch containing zero or more patch operations.
1226
+ class JSONPatch
1227
+ @ops: Array[Op]
1228
+
1229
+ # @param ops [Array<Op>?]
1230
+ def initialize: (?Array[Op | Hash[String, untyped]]? ops) -> void
1231
+
1232
+ # @param pointer [String | JSONPointer]
1233
+ # @param value [JSON-like value]
1234
+ # @return [self]
1235
+ def add: (JSONPointer | String pointer, untyped value) -> self
1236
+
1237
+ # @param pointer [String | JSONPointer]
1238
+ # @return [self]
1239
+ def remove: (JSONPointer | String pointer) -> self
1240
+
1241
+ # @param pointer [String | JSONPointer]
1242
+ # @param value [JSON-like value]
1243
+ # @return [self]
1244
+ def replace: (JSONPointer | String pointer, untyped value) -> self
1245
+
1246
+ # @param from [String | JSONPointer]
1247
+ # @param pointer [String | JSONPointer]
1248
+ # @return [self]
1249
+ def move: (JSONPointer | String from, JSONPointer | String pointer) -> self
1250
+
1251
+ # @param from [String | JSONPointer]
1252
+ # @param pointer [String | JSONPointer]
1253
+ # @return [self]
1254
+ def copy: (JSONPointer | String from, JSONPointer | String pointer) -> self
1255
+
1256
+ # @param pointer [String | JSONPointer]
1257
+ # @param value [JSON-like value]
1258
+ # @return [self]
1259
+ def test: (JSONPointer | String pointer, untyped value) -> self
1260
+
1261
+ # Apply this patch to JSON-like value _value_.
1262
+ def apply: (untyped value) -> untyped
1263
+
1264
+ def to_a: () -> Array[untyped]
1265
+
1266
+ private
1267
+
1268
+ def ensure_pointer: (JSONPointer | String pointer, Symbol op, Integer index) -> JSONPointer
1269
+
1270
+ def build: (Array[Op | Hash[String, untyped]]) -> void
1271
+
1272
+ def op_pointer: (Hash[String, untyped] obj, String key, String op, Integer index) -> JSONPointer
1273
+
1274
+ def op_value: (Hash[String, untyped] obj, String key, String op, Integer index) -> untyped
1275
+ end
1276
+ end
data.tar.gz.sig CHANGED
Binary file