jmespath 1.4.0 → 1.6.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.
@@ -1,8 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
4
5
  class Function < Node
5
-
6
6
  FUNCTIONS = {}
7
7
 
8
8
  def initialize(children, options = {})
@@ -38,26 +38,30 @@ module JMESPath
38
38
  private
39
39
 
40
40
  def maybe_raise(error_type, message)
41
- unless @disable_visit_errors
42
- raise error_type, message
43
- end
41
+ raise error_type, message unless @disable_visit_errors
44
42
  end
45
43
 
46
- def call(args)
44
+ def call(_args)
47
45
  nil
48
46
  end
49
47
  end
50
48
 
51
49
  module TypeChecker
52
50
  def get_type(value)
53
- case value
54
- when String then STRING_TYPE
55
- when true, false then BOOLEAN_TYPE
56
- when nil then NULL_TYPE
57
- when Numeric then NUMBER_TYPE
58
- when Hash, Struct then OBJECT_TYPE
59
- when Array then ARRAY_TYPE
60
- when Expression then EXPRESSION_TYPE
51
+ if value.respond_to?(:to_str)
52
+ STRING_TYPE
53
+ elsif value == true || value == false
54
+ BOOLEAN_TYPE
55
+ elsif value.nil?
56
+ NULL_TYPE
57
+ elsif value.is_a?(Numeric)
58
+ NUMBER_TYPE
59
+ elsif value.respond_to?(:to_hash) || value.is_a?(Struct)
60
+ OBJECT_TYPE
61
+ elsif value.respond_to?(:to_ary)
62
+ ARRAY_TYPE
63
+ elsif value.is_a?(Expression)
64
+ EXPRESSION_TYPE
61
65
  end
62
66
  end
63
67
 
@@ -76,7 +80,7 @@ module JMESPath
76
80
  NULL_TYPE => 'null',
77
81
  NUMBER_TYPE => 'number',
78
82
  OBJECT_TYPE => 'object',
79
- STRING_TYPE => 'string',
83
+ STRING_TYPE => 'string'
80
84
  }.freeze
81
85
  end
82
86
 
@@ -87,12 +91,12 @@ module JMESPath
87
91
  if args.count == 1
88
92
  value = args.first
89
93
  else
90
- return maybe_raise Errors::InvalidArityError, "function abs() expects one argument"
94
+ return maybe_raise Errors::InvalidArityError, 'function abs() expects one argument'
91
95
  end
92
96
  if Numeric === value
93
97
  value.abs
94
98
  else
95
- return maybe_raise Errors::InvalidTypeError, "function abs() expects a number"
99
+ return maybe_raise Errors::InvalidTypeError, 'function abs() expects a number'
96
100
  end
97
101
  end
98
102
  end
@@ -104,19 +108,20 @@ module JMESPath
104
108
  if args.count == 1
105
109
  values = args.first
106
110
  else
107
- return maybe_raise Errors::InvalidArityError, "function avg() expects one argument"
111
+ return maybe_raise Errors::InvalidArityError, 'function avg() expects one argument'
108
112
  end
109
- if Array === values
113
+ if values.respond_to?(:to_ary)
114
+ values = values.to_ary
110
115
  return nil if values.empty?
111
- values.inject(0) do |total,n|
116
+ values.inject(0) do |total, n|
112
117
  if Numeric === n
113
118
  total + n
114
119
  else
115
- return maybe_raise Errors::InvalidTypeError, "function avg() expects numeric values"
120
+ return maybe_raise Errors::InvalidTypeError, 'function avg() expects numeric values'
116
121
  end
117
122
  end / values.size.to_f
118
123
  else
119
- return maybe_raise Errors::InvalidTypeError, "function avg() expects a number"
124
+ return maybe_raise Errors::InvalidTypeError, 'function avg() expects a number'
120
125
  end
121
126
  end
122
127
  end
@@ -128,12 +133,12 @@ module JMESPath
128
133
  if args.count == 1
129
134
  value = args.first
130
135
  else
131
- return maybe_raise Errors::InvalidArityError, "function ceil() expects one argument"
136
+ return maybe_raise Errors::InvalidArityError, 'function ceil() expects one argument'
132
137
  end
133
138
  if Numeric === value
134
139
  value.ceil
135
140
  else
136
- return maybe_raise Errors::InvalidTypeError, "function ceil() expects a numeric value"
141
+ return maybe_raise Errors::InvalidTypeError, 'function ceil() expects a numeric value'
137
142
  end
138
143
  end
139
144
  end
@@ -144,14 +149,16 @@ module JMESPath
144
149
  def call(args)
145
150
  if args.count == 2
146
151
  haystack = args[0]
147
- needle = args[1]
148
- if String === haystack || Array === haystack
149
- haystack.include?(needle)
152
+ needle = Util.as_json(args[1])
153
+ if haystack.respond_to?(:to_str)
154
+ haystack.to_str.include?(needle)
155
+ elsif haystack.respond_to?(:to_ary)
156
+ haystack.to_ary.any? { |e| Util.as_json(e) == needle }
150
157
  else
151
- return maybe_raise Errors::InvalidTypeError, "contains expects 2nd arg to be a list"
158
+ return maybe_raise Errors::InvalidTypeError, 'contains expects 2nd arg to be a list'
152
159
  end
153
160
  else
154
- return maybe_raise Errors::InvalidArityError, "function contains() expects 2 arguments"
161
+ return maybe_raise Errors::InvalidArityError, 'function contains() expects 2 arguments'
155
162
  end
156
163
  end
157
164
  end
@@ -163,12 +170,12 @@ module JMESPath
163
170
  if args.count == 1
164
171
  value = args.first
165
172
  else
166
- return maybe_raise Errors::InvalidArityError, "function floor() expects one argument"
173
+ return maybe_raise Errors::InvalidArityError, 'function floor() expects one argument'
167
174
  end
168
175
  if Numeric === value
169
176
  value.floor
170
177
  else
171
- return maybe_raise Errors::InvalidTypeError, "function floor() expects a numeric value"
178
+ return maybe_raise Errors::InvalidTypeError, 'function floor() expects a numeric value'
172
179
  end
173
180
  end
174
181
  end
@@ -180,36 +187,39 @@ module JMESPath
180
187
  if args.count == 1
181
188
  value = args.first
182
189
  else
183
- return maybe_raise Errors::InvalidArityError, "function length() expects one argument"
184
- end
185
- case value
186
- when Hash, Array, String then value.size
187
- else return maybe_raise Errors::InvalidTypeError, "function length() expects string, array or object"
190
+ return maybe_raise Errors::InvalidArityError, 'function length() expects one argument'
191
+ end
192
+ if value.respond_to?(:to_hash)
193
+ value.to_hash.size
194
+ elsif value.respond_to?(:to_ary)
195
+ value.to_ary.size
196
+ elsif value.respond_to?(:to_str)
197
+ value.to_str.size
198
+ else
199
+ return maybe_raise Errors::InvalidTypeError, 'function length() expects string, array or object'
188
200
  end
189
201
  end
190
202
  end
191
203
 
192
204
  class Map < Function
193
-
194
205
  FUNCTIONS['map'] = self
195
206
 
196
207
  def call(args)
197
208
  if args.count != 2
198
- return maybe_raise Errors::InvalidArityError, "function map() expects two arguments"
209
+ return maybe_raise Errors::InvalidArityError, 'function map() expects two arguments'
199
210
  end
200
211
  if Nodes::Expression === args[0]
201
212
  expr = args[0]
202
213
  else
203
- return maybe_raise Errors::InvalidTypeError, "function map() expects the first argument to be an expression"
214
+ return maybe_raise Errors::InvalidTypeError, 'function map() expects the first argument to be an expression'
204
215
  end
205
- if Array === args[1]
206
- list = args[1]
216
+ if args[1].respond_to?(:to_ary)
217
+ list = args[1].to_ary
207
218
  else
208
- return maybe_raise Errors::InvalidTypeError, "function map() expects the second argument to be an list"
219
+ return maybe_raise Errors::InvalidTypeError, 'function map() expects the second argument to be an list'
209
220
  end
210
221
  list.map { |value| expr.eval(value) }
211
222
  end
212
-
213
223
  end
214
224
 
215
225
  class MaxFunction < Function
@@ -221,14 +231,15 @@ module JMESPath
221
231
  if args.count == 1
222
232
  values = args.first
223
233
  else
224
- return maybe_raise Errors::InvalidArityError, "function max() expects one argument"
234
+ return maybe_raise Errors::InvalidArityError, 'function max() expects one argument'
225
235
  end
226
- if Array === values
236
+ if values.respond_to?(:to_ary)
237
+ values = values.to_ary
227
238
  return nil if values.empty?
228
239
  first = values.first
229
240
  first_type = get_type(first)
230
241
  unless first_type == NUMBER_TYPE || first_type == STRING_TYPE
231
- msg = "function max() expects numeric or string values"
242
+ msg = String.new('function max() expects numeric or string values')
232
243
  return maybe_raise Errors::InvalidTypeError, msg
233
244
  end
234
245
  values.inject([first, first_type]) do |(max, max_type), v|
@@ -236,13 +247,13 @@ module JMESPath
236
247
  if max_type == v_type
237
248
  v > max ? [v, v_type] : [max, max_type]
238
249
  else
239
- msg = "function max() encountered a type mismatch in sequence: "
250
+ msg = String.new('function max() encountered a type mismatch in sequence: ')
240
251
  msg << "#{max_type}, #{v_type}"
241
252
  return maybe_raise Errors::InvalidTypeError, msg
242
253
  end
243
254
  end.first
244
255
  else
245
- return maybe_raise Errors::InvalidTypeError, "function max() expects an array"
256
+ return maybe_raise Errors::InvalidTypeError, 'function max() expects an array'
246
257
  end
247
258
  end
248
259
  end
@@ -256,14 +267,15 @@ module JMESPath
256
267
  if args.count == 1
257
268
  values = args.first
258
269
  else
259
- return maybe_raise Errors::InvalidArityError, "function min() expects one argument"
270
+ return maybe_raise Errors::InvalidArityError, 'function min() expects one argument'
260
271
  end
261
- if Array === values
272
+ if values.respond_to?(:to_ary)
273
+ values = values.to_ary
262
274
  return nil if values.empty?
263
275
  first = values.first
264
276
  first_type = get_type(first)
265
277
  unless first_type == NUMBER_TYPE || first_type == STRING_TYPE
266
- msg = "function min() expects numeric or string values"
278
+ msg = String.new('function min() expects numeric or string values')
267
279
  return maybe_raise Errors::InvalidTypeError, msg
268
280
  end
269
281
  values.inject([first, first_type]) do |(min, min_type), v|
@@ -271,13 +283,13 @@ module JMESPath
271
283
  if min_type == v_type
272
284
  v < min ? [v, v_type] : [min, min_type]
273
285
  else
274
- msg = "function min() encountered a type mismatch in sequence: "
286
+ msg = String.new('function min() encountered a type mismatch in sequence: ')
275
287
  msg << "#{min_type}, #{v_type}"
276
288
  return maybe_raise Errors::InvalidTypeError, msg
277
289
  end
278
290
  end.first
279
291
  else
280
- return maybe_raise Errors::InvalidTypeError, "function min() expects an array"
292
+ return maybe_raise Errors::InvalidTypeError, 'function min() expects an array'
281
293
  end
282
294
  end
283
295
  end
@@ -291,7 +303,7 @@ module JMESPath
291
303
  if args.count == 1
292
304
  TYPE_NAMES[get_type(args.first)]
293
305
  else
294
- return maybe_raise Errors::InvalidArityError, "function type() expects one argument"
306
+ return maybe_raise Errors::InvalidArityError, 'function type() expects one argument'
295
307
  end
296
308
  end
297
309
  end
@@ -302,17 +314,15 @@ module JMESPath
302
314
  def call(args)
303
315
  if args.count == 1
304
316
  value = args.first
305
- if hash_like?(value)
306
- case value
307
- when Hash then value.keys.map(&:to_s)
308
- when Struct then value.members.map(&:to_s)
309
- else raise NotImplementedError
310
- end
317
+ if value.respond_to?(:to_hash)
318
+ value.to_hash.keys.map(&:to_s)
319
+ elsif value.is_a?(Struct)
320
+ value.members.map(&:to_s)
311
321
  else
312
- return maybe_raise Errors::InvalidTypeError, "function keys() expects a hash"
322
+ return maybe_raise Errors::InvalidTypeError, 'function keys() expects a hash'
313
323
  end
314
324
  else
315
- return maybe_raise Errors::InvalidArityError, "function keys() expects one argument"
325
+ return maybe_raise Errors::InvalidArityError, 'function keys() expects one argument'
316
326
  end
317
327
  end
318
328
  end
@@ -323,15 +333,17 @@ module JMESPath
323
333
  def call(args)
324
334
  if args.count == 1
325
335
  value = args.first
326
- if hash_like?(value)
336
+ if value.respond_to?(:to_hash)
337
+ value.to_hash.values
338
+ elsif value.is_a?(Struct)
327
339
  value.values
328
- elsif Array === value
329
- value
340
+ elsif value.respond_to?(:to_ary)
341
+ value.to_ary
330
342
  else
331
- return maybe_raise Errors::InvalidTypeError, "function values() expects an array or a hash"
343
+ return maybe_raise Errors::InvalidTypeError, 'function values() expects an array or a hash'
332
344
  end
333
345
  else
334
- return maybe_raise Errors::InvalidArityError, "function values() expects one argument"
346
+ return maybe_raise Errors::InvalidArityError, 'function values() expects one argument'
335
347
  end
336
348
  end
337
349
  end
@@ -343,15 +355,15 @@ module JMESPath
343
355
  if args.count == 2
344
356
  glue = args[0]
345
357
  values = args[1]
346
- if !(String === glue)
347
- return maybe_raise Errors::InvalidTypeError, "function join() expects the first argument to be a string"
348
- elsif Array === values && values.all? { |v| String === v }
349
- values.join(glue)
358
+ if !glue.respond_to?(:to_str)
359
+ return maybe_raise Errors::InvalidTypeError, 'function join() expects the first argument to be a string'
360
+ elsif values.respond_to?(:to_ary) && values.to_ary.all? { |v| v.respond_to?(:to_str) }
361
+ values.to_ary.join(glue)
350
362
  else
351
- return maybe_raise Errors::InvalidTypeError, "function join() expects values to be an array of strings"
363
+ return maybe_raise Errors::InvalidTypeError, 'function join() expects values to be an array of strings'
352
364
  end
353
365
  else
354
- return maybe_raise Errors::InvalidArityError, "function join() expects an array of strings"
366
+ return maybe_raise Errors::InvalidArityError, 'function join() expects an array of strings'
355
367
  end
356
368
  end
357
369
  end
@@ -362,9 +374,9 @@ module JMESPath
362
374
  def call(args)
363
375
  if args.count == 1
364
376
  value = args.first
365
- String === value ? value : value.to_json
377
+ value.respond_to?(:to_str) ? value.to_str : value.to_json
366
378
  else
367
- return maybe_raise Errors::InvalidArityError, "function to_string() expects one argument"
379
+ return maybe_raise Errors::InvalidArityError, 'function to_string() expects one argument'
368
380
  end
369
381
  end
370
382
  end
@@ -381,7 +393,7 @@ module JMESPath
381
393
  nil
382
394
  end
383
395
  else
384
- return maybe_raise Errors::InvalidArityError, "function to_number() expects one argument"
396
+ return maybe_raise Errors::InvalidArityError, 'function to_number() expects one argument'
385
397
  end
386
398
  end
387
399
  end
@@ -390,16 +402,16 @@ module JMESPath
390
402
  FUNCTIONS['sum'] = self
391
403
 
392
404
  def call(args)
393
- if args.count == 1 && Array === args.first
394
- args.first.inject(0) do |sum,n|
405
+ if args.count == 1 && args.first.respond_to?(:to_ary)
406
+ args.first.to_ary.inject(0) do |sum, n|
395
407
  if Numeric === n
396
408
  sum + n
397
409
  else
398
- return maybe_raise Errors::InvalidTypeError, "function sum() expects values to be numeric"
410
+ return maybe_raise Errors::InvalidTypeError, 'function sum() expects values to be numeric'
399
411
  end
400
412
  end
401
413
  else
402
- return maybe_raise Errors::InvalidArityError, "function sum() expects one argument"
414
+ return maybe_raise Errors::InvalidArityError, 'function sum() expects one argument'
403
415
  end
404
416
  end
405
417
  end
@@ -411,7 +423,7 @@ module JMESPath
411
423
  if args.count > 0
412
424
  args.find { |value| !value.nil? }
413
425
  else
414
- return maybe_raise Errors::InvalidArityError, "function not_null() expects one or more arguments"
426
+ return maybe_raise Errors::InvalidArityError, 'function not_null() expects one or more arguments'
415
427
  end
416
428
  end
417
429
  end
@@ -424,29 +436,30 @@ module JMESPath
424
436
  def call(args)
425
437
  if args.count == 1
426
438
  value = args.first
427
- if Array === value
439
+ if value.respond_to?(:to_ary)
440
+ value = value.to_ary
428
441
  # every element in the list must be of the same type
429
442
  array_type = get_type(value[0])
430
- if array_type == STRING_TYPE || array_type == NUMBER_TYPE || value.size == 0
443
+ if array_type == STRING_TYPE || array_type == NUMBER_TYPE || value.empty?
431
444
  # stable sort
432
445
  n = 0
433
446
  value.sort_by do |v|
434
447
  value_type = get_type(v)
435
448
  if value_type != array_type
436
- msg = "function sort() expects values to be an array of only numbers, or only integers"
449
+ msg = 'function sort() expects values to be an array of only numbers, or only integers'
437
450
  return maybe_raise Errors::InvalidTypeError, msg
438
451
  end
439
452
  n += 1
440
453
  [v, n]
441
454
  end
442
455
  else
443
- return maybe_raise Errors::InvalidTypeError, "function sort() expects values to be an array of numbers or integers"
456
+ return maybe_raise Errors::InvalidTypeError, 'function sort() expects values to be an array of numbers or integers'
444
457
  end
445
458
  else
446
- return maybe_raise Errors::InvalidTypeError, "function sort() expects values to be an array of numbers or integers"
459
+ return maybe_raise Errors::InvalidTypeError, 'function sort() expects values to be an array of numbers or integers'
447
460
  end
448
461
  else
449
- return maybe_raise Errors::InvalidArityError, "function sort() expects one argument"
462
+ return maybe_raise Errors::InvalidArityError, 'function sort() expects one argument'
450
463
  end
451
464
  end
452
465
  end
@@ -459,30 +472,30 @@ module JMESPath
459
472
  def call(args)
460
473
  if args.count == 2
461
474
  if get_type(args[0]) == ARRAY_TYPE && get_type(args[1]) == EXPRESSION_TYPE
462
- values = args[0]
475
+ values = args[0].to_ary
463
476
  expression = args[1]
464
477
  array_type = get_type(expression.eval(values[0]))
465
- if array_type == STRING_TYPE || array_type == NUMBER_TYPE || values.size == 0
478
+ if array_type == STRING_TYPE || array_type == NUMBER_TYPE || values.empty?
466
479
  # stable sort the list
467
480
  n = 0
468
481
  values.sort_by do |value|
469
482
  value = expression.eval(value)
470
483
  value_type = get_type(value)
471
484
  if value_type != array_type
472
- msg = "function sort() expects values to be an array of only numbers, or only integers"
485
+ msg = 'function sort() expects values to be an array of only numbers, or only integers'
473
486
  return maybe_raise Errors::InvalidTypeError, msg
474
487
  end
475
488
  n += 1
476
489
  [value, n]
477
490
  end
478
491
  else
479
- return maybe_raise Errors::InvalidTypeError, "function sort() expects values to be an array of numbers or integers"
492
+ return maybe_raise Errors::InvalidTypeError, 'function sort() expects values to be an array of numbers or integers'
480
493
  end
481
494
  else
482
- return maybe_raise Errors::InvalidTypeError, "function sort_by() expects an array and an expression"
495
+ return maybe_raise Errors::InvalidTypeError, 'function sort_by() expects an array and an expression'
483
496
  end
484
497
  else
485
- return maybe_raise Errors::InvalidArityError, "function sort_by() expects two arguments"
498
+ return maybe_raise Errors::InvalidArityError, 'function sort_by() expects two arguments'
486
499
  end
487
500
  end
488
501
  end
@@ -495,6 +508,7 @@ module JMESPath
495
508
  values = args[0]
496
509
  expression = args[1]
497
510
  if get_type(values) == ARRAY_TYPE && get_type(expression) == EXPRESSION_TYPE
511
+ values = values.to_ary
498
512
  type = get_type(expression.eval(values.first))
499
513
  if type != NUMBER_TYPE && type != STRING_TYPE
500
514
  msg = "function #{mode}() expects values to be strings or numbers"
@@ -504,7 +518,7 @@ module JMESPath
504
518
  value = expression.eval(entry)
505
519
  value_type = get_type(value)
506
520
  if value_type != type
507
- msg = "function #{mode}() encountered a type mismatch in "
521
+ msg = String.new("function #{mode}() encountered a type mismatch in ")
508
522
  msg << "sequence: #{type}, #{value_type}"
509
523
  return maybe_raise Errors::InvalidTypeError, msg
510
524
  end
@@ -552,16 +566,16 @@ module JMESPath
552
566
  search_type = get_type(search)
553
567
  suffix_type = get_type(suffix)
554
568
  if search_type != STRING_TYPE
555
- msg = "function ends_with() expects first argument to be a string"
569
+ msg = 'function ends_with() expects first argument to be a string'
556
570
  return maybe_raise Errors::InvalidTypeError, msg
557
571
  end
558
572
  if suffix_type != STRING_TYPE
559
- msg = "function ends_with() expects second argument to be a string"
573
+ msg = 'function ends_with() expects second argument to be a string'
560
574
  return maybe_raise Errors::InvalidTypeError, msg
561
575
  end
562
576
  search.end_with?(suffix)
563
577
  else
564
- msg = "function ends_with() expects two arguments"
578
+ msg = 'function ends_with() expects two arguments'
565
579
  return maybe_raise Errors::InvalidArityError, msg
566
580
  end
567
581
  end
@@ -578,16 +592,16 @@ module JMESPath
578
592
  search_type = get_type(search)
579
593
  prefix_type = get_type(prefix)
580
594
  if search_type != STRING_TYPE
581
- msg = "function starts_with() expects first argument to be a string"
595
+ msg = 'function starts_with() expects first argument to be a string'
582
596
  return maybe_raise Errors::InvalidTypeError, msg
583
597
  end
584
598
  if prefix_type != STRING_TYPE
585
- msg = "function starts_with() expects second argument to be a string"
599
+ msg = 'function starts_with() expects second argument to be a string'
586
600
  return maybe_raise Errors::InvalidTypeError, msg
587
601
  end
588
602
  search.start_with?(prefix)
589
603
  else
590
- msg = "function starts_with() expects two arguments"
604
+ msg = 'function starts_with() expects two arguments'
591
605
  return maybe_raise Errors::InvalidArityError, msg
592
606
  end
593
607
  end
@@ -598,7 +612,7 @@ module JMESPath
598
612
 
599
613
  def call(args)
600
614
  if args.count == 0
601
- msg = "function merge() expects 1 or more arguments"
615
+ msg = 'function merge() expects 1 or more arguments'
602
616
  return maybe_raise Errors::InvalidArityError, msg
603
617
  end
604
618
  args.inject({}) do |h, v|
@@ -612,14 +626,16 @@ module JMESPath
612
626
 
613
627
  def call(args)
614
628
  if args.count == 0
615
- msg = "function reverse() expects 1 or more arguments"
629
+ msg = 'function reverse() expects 1 or more arguments'
616
630
  return maybe_raise Errors::InvalidArityError, msg
617
631
  end
618
632
  value = args.first
619
- if Array === value || String === value
620
- value.reverse
633
+ if value.respond_to?(:to_ary)
634
+ value.to_ary.reverse
635
+ elsif value.respond_to?(:to_str)
636
+ value.to_str.reverse
621
637
  else
622
- msg = "function reverse() expects an array or string"
638
+ msg = 'function reverse() expects an array or string'
623
639
  return maybe_raise Errors::InvalidTypeError, msg
624
640
  end
625
641
  end
@@ -630,7 +646,7 @@ module JMESPath
630
646
 
631
647
  def call(args)
632
648
  value = args.first
633
- Array === value ? value : [value]
649
+ value.respond_to?(:to_ary) ? value.to_ary : [value]
634
650
  end
635
651
  end
636
652
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
@@ -8,7 +9,7 @@ module JMESPath
8
9
  @value = value
9
10
  end
10
11
 
11
- def visit(value)
12
+ def visit(_value)
12
13
  @value
13
14
  end
14
15
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
@@ -1,7 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  module Nodes
3
4
  class Not < Node
4
-
5
5
  def initialize(expression)
6
6
  @expression = expression
7
7
  end
@@ -13,7 +13,6 @@ module JMESPath
13
13
  def optimize
14
14
  self.class.new(@expression.optimize)
15
15
  end
16
-
17
16
  end
18
17
  end
19
18
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JMESPath
2
3
  # @api private
3
4
  module Nodes