cucumber-messages 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1208 @@
1
+ require 'cucumber/messages.dtos'
2
+ require 'json'
3
+
4
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
5
+ #
6
+
7
+ module Cucumber
8
+ module Messages
9
+
10
+ class Attachment
11
+
12
+ ##
13
+ # Returns a new Attachment from the given hash.
14
+ # If the hash keys are camelCased, they are properly assigned to the
15
+ # corresponding snake_cased attributes.
16
+ #
17
+ # Cucumber::Messages::Attachment.from_h(some_hash) # => #<Cucumber::Messages::Attachment:0x... ...>
18
+ #
19
+
20
+ def self.from_h(hash)
21
+ return nil if hash.nil?
22
+
23
+ self.new(
24
+ body: hash[:body],
25
+ content_encoding: hash[:contentEncoding],
26
+ file_name: hash[:fileName],
27
+ media_type: hash[:mediaType],
28
+ source: Source.from_h(hash[:source]),
29
+ test_case_started_id: hash[:testCaseStartedId],
30
+ test_step_id: hash[:testStepId],
31
+ url: hash[:url],
32
+ )
33
+ end
34
+ end
35
+
36
+ class Duration
37
+
38
+ ##
39
+ # Returns a new Duration from the given hash.
40
+ # If the hash keys are camelCased, they are properly assigned to the
41
+ # corresponding snake_cased attributes.
42
+ #
43
+ # Cucumber::Messages::Duration.from_h(some_hash) # => #<Cucumber::Messages::Duration:0x... ...>
44
+ #
45
+
46
+ def self.from_h(hash)
47
+ return nil if hash.nil?
48
+
49
+ self.new(
50
+ seconds: hash[:seconds],
51
+ nanos: hash[:nanos],
52
+ )
53
+ end
54
+ end
55
+
56
+ class Envelope
57
+
58
+ ##
59
+ # Returns a new Envelope from the given hash.
60
+ # If the hash keys are camelCased, they are properly assigned to the
61
+ # corresponding snake_cased attributes.
62
+ #
63
+ # Cucumber::Messages::Envelope.from_h(some_hash) # => #<Cucumber::Messages::Envelope:0x... ...>
64
+ #
65
+
66
+ def self.from_h(hash)
67
+ return nil if hash.nil?
68
+
69
+ self.new(
70
+ attachment: Attachment.from_h(hash[:attachment]),
71
+ gherkin_document: GherkinDocument.from_h(hash[:gherkinDocument]),
72
+ hook: Hook.from_h(hash[:hook]),
73
+ meta: Meta.from_h(hash[:meta]),
74
+ parameter_type: ParameterType.from_h(hash[:parameterType]),
75
+ parse_error: ParseError.from_h(hash[:parseError]),
76
+ pickle: Pickle.from_h(hash[:pickle]),
77
+ source: Source.from_h(hash[:source]),
78
+ step_definition: StepDefinition.from_h(hash[:stepDefinition]),
79
+ test_case: TestCase.from_h(hash[:testCase]),
80
+ test_case_finished: TestCaseFinished.from_h(hash[:testCaseFinished]),
81
+ test_case_started: TestCaseStarted.from_h(hash[:testCaseStarted]),
82
+ test_run_finished: TestRunFinished.from_h(hash[:testRunFinished]),
83
+ test_run_started: TestRunStarted.from_h(hash[:testRunStarted]),
84
+ test_step_finished: TestStepFinished.from_h(hash[:testStepFinished]),
85
+ test_step_started: TestStepStarted.from_h(hash[:testStepStarted]),
86
+ undefined_parameter_type: UndefinedParameterType.from_h(hash[:undefinedParameterType]),
87
+ )
88
+ end
89
+ end
90
+
91
+ class Exception
92
+
93
+ ##
94
+ # Returns a new Exception from the given hash.
95
+ # If the hash keys are camelCased, they are properly assigned to the
96
+ # corresponding snake_cased attributes.
97
+ #
98
+ # Cucumber::Messages::Exception.from_h(some_hash) # => #<Cucumber::Messages::Exception:0x... ...>
99
+ #
100
+
101
+ def self.from_h(hash)
102
+ return nil if hash.nil?
103
+
104
+ self.new(
105
+ type: hash[:type],
106
+ message: hash[:message],
107
+ stack_trace: hash[:stackTrace],
108
+ )
109
+ end
110
+ end
111
+
112
+ class GherkinDocument
113
+
114
+ ##
115
+ # Returns a new GherkinDocument from the given hash.
116
+ # If the hash keys are camelCased, they are properly assigned to the
117
+ # corresponding snake_cased attributes.
118
+ #
119
+ # Cucumber::Messages::GherkinDocument.from_h(some_hash) # => #<Cucumber::Messages::GherkinDocument:0x... ...>
120
+ #
121
+
122
+ def self.from_h(hash)
123
+ return nil if hash.nil?
124
+
125
+ self.new(
126
+ uri: hash[:uri],
127
+ feature: Feature.from_h(hash[:feature]),
128
+ comments: hash[:comments]&.map { |item| Comment.from_h(item) },
129
+ )
130
+ end
131
+ end
132
+
133
+ class Background
134
+
135
+ ##
136
+ # Returns a new Background from the given hash.
137
+ # If the hash keys are camelCased, they are properly assigned to the
138
+ # corresponding snake_cased attributes.
139
+ #
140
+ # Cucumber::Messages::Background.from_h(some_hash) # => #<Cucumber::Messages::Background:0x... ...>
141
+ #
142
+
143
+ def self.from_h(hash)
144
+ return nil if hash.nil?
145
+
146
+ self.new(
147
+ location: Location.from_h(hash[:location]),
148
+ keyword: hash[:keyword],
149
+ name: hash[:name],
150
+ description: hash[:description],
151
+ steps: hash[:steps]&.map { |item| Step.from_h(item) },
152
+ id: hash[:id],
153
+ )
154
+ end
155
+ end
156
+
157
+ class Comment
158
+
159
+ ##
160
+ # Returns a new Comment from the given hash.
161
+ # If the hash keys are camelCased, they are properly assigned to the
162
+ # corresponding snake_cased attributes.
163
+ #
164
+ # Cucumber::Messages::Comment.from_h(some_hash) # => #<Cucumber::Messages::Comment:0x... ...>
165
+ #
166
+
167
+ def self.from_h(hash)
168
+ return nil if hash.nil?
169
+
170
+ self.new(
171
+ location: Location.from_h(hash[:location]),
172
+ text: hash[:text],
173
+ )
174
+ end
175
+ end
176
+
177
+ class DataTable
178
+
179
+ ##
180
+ # Returns a new DataTable from the given hash.
181
+ # If the hash keys are camelCased, they are properly assigned to the
182
+ # corresponding snake_cased attributes.
183
+ #
184
+ # Cucumber::Messages::DataTable.from_h(some_hash) # => #<Cucumber::Messages::DataTable:0x... ...>
185
+ #
186
+
187
+ def self.from_h(hash)
188
+ return nil if hash.nil?
189
+
190
+ self.new(
191
+ location: Location.from_h(hash[:location]),
192
+ rows: hash[:rows]&.map { |item| TableRow.from_h(item) },
193
+ )
194
+ end
195
+ end
196
+
197
+ class DocString
198
+
199
+ ##
200
+ # Returns a new DocString from the given hash.
201
+ # If the hash keys are camelCased, they are properly assigned to the
202
+ # corresponding snake_cased attributes.
203
+ #
204
+ # Cucumber::Messages::DocString.from_h(some_hash) # => #<Cucumber::Messages::DocString:0x... ...>
205
+ #
206
+
207
+ def self.from_h(hash)
208
+ return nil if hash.nil?
209
+
210
+ self.new(
211
+ location: Location.from_h(hash[:location]),
212
+ media_type: hash[:mediaType],
213
+ content: hash[:content],
214
+ delimiter: hash[:delimiter],
215
+ )
216
+ end
217
+ end
218
+
219
+ class Examples
220
+
221
+ ##
222
+ # Returns a new Examples from the given hash.
223
+ # If the hash keys are camelCased, they are properly assigned to the
224
+ # corresponding snake_cased attributes.
225
+ #
226
+ # Cucumber::Messages::Examples.from_h(some_hash) # => #<Cucumber::Messages::Examples:0x... ...>
227
+ #
228
+
229
+ def self.from_h(hash)
230
+ return nil if hash.nil?
231
+
232
+ self.new(
233
+ location: Location.from_h(hash[:location]),
234
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
235
+ keyword: hash[:keyword],
236
+ name: hash[:name],
237
+ description: hash[:description],
238
+ table_header: TableRow.from_h(hash[:tableHeader]),
239
+ table_body: hash[:tableBody]&.map { |item| TableRow.from_h(item) },
240
+ id: hash[:id],
241
+ )
242
+ end
243
+ end
244
+
245
+ class Feature
246
+
247
+ ##
248
+ # Returns a new Feature from the given hash.
249
+ # If the hash keys are camelCased, they are properly assigned to the
250
+ # corresponding snake_cased attributes.
251
+ #
252
+ # Cucumber::Messages::Feature.from_h(some_hash) # => #<Cucumber::Messages::Feature:0x... ...>
253
+ #
254
+
255
+ def self.from_h(hash)
256
+ return nil if hash.nil?
257
+
258
+ self.new(
259
+ location: Location.from_h(hash[:location]),
260
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
261
+ language: hash[:language],
262
+ keyword: hash[:keyword],
263
+ name: hash[:name],
264
+ description: hash[:description],
265
+ children: hash[:children]&.map { |item| FeatureChild.from_h(item) },
266
+ )
267
+ end
268
+ end
269
+
270
+ class FeatureChild
271
+
272
+ ##
273
+ # Returns a new FeatureChild from the given hash.
274
+ # If the hash keys are camelCased, they are properly assigned to the
275
+ # corresponding snake_cased attributes.
276
+ #
277
+ # Cucumber::Messages::FeatureChild.from_h(some_hash) # => #<Cucumber::Messages::FeatureChild:0x... ...>
278
+ #
279
+
280
+ def self.from_h(hash)
281
+ return nil if hash.nil?
282
+
283
+ self.new(
284
+ rule: Rule.from_h(hash[:rule]),
285
+ background: Background.from_h(hash[:background]),
286
+ scenario: Scenario.from_h(hash[:scenario]),
287
+ )
288
+ end
289
+ end
290
+
291
+ class Rule
292
+
293
+ ##
294
+ # Returns a new Rule from the given hash.
295
+ # If the hash keys are camelCased, they are properly assigned to the
296
+ # corresponding snake_cased attributes.
297
+ #
298
+ # Cucumber::Messages::Rule.from_h(some_hash) # => #<Cucumber::Messages::Rule:0x... ...>
299
+ #
300
+
301
+ def self.from_h(hash)
302
+ return nil if hash.nil?
303
+
304
+ self.new(
305
+ location: Location.from_h(hash[:location]),
306
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
307
+ keyword: hash[:keyword],
308
+ name: hash[:name],
309
+ description: hash[:description],
310
+ children: hash[:children]&.map { |item| RuleChild.from_h(item) },
311
+ id: hash[:id],
312
+ )
313
+ end
314
+ end
315
+
316
+ class RuleChild
317
+
318
+ ##
319
+ # Returns a new RuleChild from the given hash.
320
+ # If the hash keys are camelCased, they are properly assigned to the
321
+ # corresponding snake_cased attributes.
322
+ #
323
+ # Cucumber::Messages::RuleChild.from_h(some_hash) # => #<Cucumber::Messages::RuleChild:0x... ...>
324
+ #
325
+
326
+ def self.from_h(hash)
327
+ return nil if hash.nil?
328
+
329
+ self.new(
330
+ background: Background.from_h(hash[:background]),
331
+ scenario: Scenario.from_h(hash[:scenario]),
332
+ )
333
+ end
334
+ end
335
+
336
+ class Scenario
337
+
338
+ ##
339
+ # Returns a new Scenario from the given hash.
340
+ # If the hash keys are camelCased, they are properly assigned to the
341
+ # corresponding snake_cased attributes.
342
+ #
343
+ # Cucumber::Messages::Scenario.from_h(some_hash) # => #<Cucumber::Messages::Scenario:0x... ...>
344
+ #
345
+
346
+ def self.from_h(hash)
347
+ return nil if hash.nil?
348
+
349
+ self.new(
350
+ location: Location.from_h(hash[:location]),
351
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
352
+ keyword: hash[:keyword],
353
+ name: hash[:name],
354
+ description: hash[:description],
355
+ steps: hash[:steps]&.map { |item| Step.from_h(item) },
356
+ examples: hash[:examples]&.map { |item| Examples.from_h(item) },
357
+ id: hash[:id],
358
+ )
359
+ end
360
+ end
361
+
362
+ class Step
363
+
364
+ ##
365
+ # Returns a new Step from the given hash.
366
+ # If the hash keys are camelCased, they are properly assigned to the
367
+ # corresponding snake_cased attributes.
368
+ #
369
+ # Cucumber::Messages::Step.from_h(some_hash) # => #<Cucumber::Messages::Step:0x... ...>
370
+ #
371
+
372
+ def self.from_h(hash)
373
+ return nil if hash.nil?
374
+
375
+ self.new(
376
+ location: Location.from_h(hash[:location]),
377
+ keyword: hash[:keyword],
378
+ keyword_type: hash[:keywordType],
379
+ text: hash[:text],
380
+ doc_string: DocString.from_h(hash[:docString]),
381
+ data_table: DataTable.from_h(hash[:dataTable]),
382
+ id: hash[:id],
383
+ )
384
+ end
385
+ end
386
+
387
+ class TableCell
388
+
389
+ ##
390
+ # Returns a new TableCell from the given hash.
391
+ # If the hash keys are camelCased, they are properly assigned to the
392
+ # corresponding snake_cased attributes.
393
+ #
394
+ # Cucumber::Messages::TableCell.from_h(some_hash) # => #<Cucumber::Messages::TableCell:0x... ...>
395
+ #
396
+
397
+ def self.from_h(hash)
398
+ return nil if hash.nil?
399
+
400
+ self.new(
401
+ location: Location.from_h(hash[:location]),
402
+ value: hash[:value],
403
+ )
404
+ end
405
+ end
406
+
407
+ class TableRow
408
+
409
+ ##
410
+ # Returns a new TableRow from the given hash.
411
+ # If the hash keys are camelCased, they are properly assigned to the
412
+ # corresponding snake_cased attributes.
413
+ #
414
+ # Cucumber::Messages::TableRow.from_h(some_hash) # => #<Cucumber::Messages::TableRow:0x... ...>
415
+ #
416
+
417
+ def self.from_h(hash)
418
+ return nil if hash.nil?
419
+
420
+ self.new(
421
+ location: Location.from_h(hash[:location]),
422
+ cells: hash[:cells]&.map { |item| TableCell.from_h(item) },
423
+ id: hash[:id],
424
+ )
425
+ end
426
+ end
427
+
428
+ class Tag
429
+
430
+ ##
431
+ # Returns a new Tag from the given hash.
432
+ # If the hash keys are camelCased, they are properly assigned to the
433
+ # corresponding snake_cased attributes.
434
+ #
435
+ # Cucumber::Messages::Tag.from_h(some_hash) # => #<Cucumber::Messages::Tag:0x... ...>
436
+ #
437
+
438
+ def self.from_h(hash)
439
+ return nil if hash.nil?
440
+
441
+ self.new(
442
+ location: Location.from_h(hash[:location]),
443
+ name: hash[:name],
444
+ id: hash[:id],
445
+ )
446
+ end
447
+ end
448
+
449
+ class Hook
450
+
451
+ ##
452
+ # Returns a new Hook from the given hash.
453
+ # If the hash keys are camelCased, they are properly assigned to the
454
+ # corresponding snake_cased attributes.
455
+ #
456
+ # Cucumber::Messages::Hook.from_h(some_hash) # => #<Cucumber::Messages::Hook:0x... ...>
457
+ #
458
+
459
+ def self.from_h(hash)
460
+ return nil if hash.nil?
461
+
462
+ self.new(
463
+ id: hash[:id],
464
+ name: hash[:name],
465
+ source_reference: SourceReference.from_h(hash[:sourceReference]),
466
+ tag_expression: hash[:tagExpression],
467
+ )
468
+ end
469
+ end
470
+
471
+ class Location
472
+
473
+ ##
474
+ # Returns a new Location from the given hash.
475
+ # If the hash keys are camelCased, they are properly assigned to the
476
+ # corresponding snake_cased attributes.
477
+ #
478
+ # Cucumber::Messages::Location.from_h(some_hash) # => #<Cucumber::Messages::Location:0x... ...>
479
+ #
480
+
481
+ def self.from_h(hash)
482
+ return nil if hash.nil?
483
+
484
+ self.new(
485
+ line: hash[:line],
486
+ column: hash[:column],
487
+ )
488
+ end
489
+ end
490
+
491
+ class Meta
492
+
493
+ ##
494
+ # Returns a new Meta from the given hash.
495
+ # If the hash keys are camelCased, they are properly assigned to the
496
+ # corresponding snake_cased attributes.
497
+ #
498
+ # Cucumber::Messages::Meta.from_h(some_hash) # => #<Cucumber::Messages::Meta:0x... ...>
499
+ #
500
+
501
+ def self.from_h(hash)
502
+ return nil if hash.nil?
503
+
504
+ self.new(
505
+ protocol_version: hash[:protocolVersion],
506
+ implementation: Product.from_h(hash[:implementation]),
507
+ runtime: Product.from_h(hash[:runtime]),
508
+ os: Product.from_h(hash[:os]),
509
+ cpu: Product.from_h(hash[:cpu]),
510
+ ci: Ci.from_h(hash[:ci]),
511
+ )
512
+ end
513
+ end
514
+
515
+ class Ci
516
+
517
+ ##
518
+ # Returns a new Ci from the given hash.
519
+ # If the hash keys are camelCased, they are properly assigned to the
520
+ # corresponding snake_cased attributes.
521
+ #
522
+ # Cucumber::Messages::Ci.from_h(some_hash) # => #<Cucumber::Messages::Ci:0x... ...>
523
+ #
524
+
525
+ def self.from_h(hash)
526
+ return nil if hash.nil?
527
+
528
+ self.new(
529
+ name: hash[:name],
530
+ url: hash[:url],
531
+ build_number: hash[:buildNumber],
532
+ git: Git.from_h(hash[:git]),
533
+ )
534
+ end
535
+ end
536
+
537
+ class Git
538
+
539
+ ##
540
+ # Returns a new Git from the given hash.
541
+ # If the hash keys are camelCased, they are properly assigned to the
542
+ # corresponding snake_cased attributes.
543
+ #
544
+ # Cucumber::Messages::Git.from_h(some_hash) # => #<Cucumber::Messages::Git:0x... ...>
545
+ #
546
+
547
+ def self.from_h(hash)
548
+ return nil if hash.nil?
549
+
550
+ self.new(
551
+ remote: hash[:remote],
552
+ revision: hash[:revision],
553
+ branch: hash[:branch],
554
+ tag: hash[:tag],
555
+ )
556
+ end
557
+ end
558
+
559
+ class Product
560
+
561
+ ##
562
+ # Returns a new Product from the given hash.
563
+ # If the hash keys are camelCased, they are properly assigned to the
564
+ # corresponding snake_cased attributes.
565
+ #
566
+ # Cucumber::Messages::Product.from_h(some_hash) # => #<Cucumber::Messages::Product:0x... ...>
567
+ #
568
+
569
+ def self.from_h(hash)
570
+ return nil if hash.nil?
571
+
572
+ self.new(
573
+ name: hash[:name],
574
+ version: hash[:version],
575
+ )
576
+ end
577
+ end
578
+
579
+ class ParameterType
580
+
581
+ ##
582
+ # Returns a new ParameterType from the given hash.
583
+ # If the hash keys are camelCased, they are properly assigned to the
584
+ # corresponding snake_cased attributes.
585
+ #
586
+ # Cucumber::Messages::ParameterType.from_h(some_hash) # => #<Cucumber::Messages::ParameterType:0x... ...>
587
+ #
588
+
589
+ def self.from_h(hash)
590
+ return nil if hash.nil?
591
+
592
+ self.new(
593
+ name: hash[:name],
594
+ regular_expressions: hash[:regularExpressions],
595
+ prefer_for_regular_expression_match: hash[:preferForRegularExpressionMatch],
596
+ use_for_snippets: hash[:useForSnippets],
597
+ id: hash[:id],
598
+ source_reference: SourceReference.from_h(hash[:sourceReference]),
599
+ )
600
+ end
601
+ end
602
+
603
+ class ParseError
604
+
605
+ ##
606
+ # Returns a new ParseError from the given hash.
607
+ # If the hash keys are camelCased, they are properly assigned to the
608
+ # corresponding snake_cased attributes.
609
+ #
610
+ # Cucumber::Messages::ParseError.from_h(some_hash) # => #<Cucumber::Messages::ParseError:0x... ...>
611
+ #
612
+
613
+ def self.from_h(hash)
614
+ return nil if hash.nil?
615
+
616
+ self.new(
617
+ source: SourceReference.from_h(hash[:source]),
618
+ message: hash[:message],
619
+ )
620
+ end
621
+ end
622
+
623
+ class Pickle
624
+
625
+ ##
626
+ # Returns a new Pickle from the given hash.
627
+ # If the hash keys are camelCased, they are properly assigned to the
628
+ # corresponding snake_cased attributes.
629
+ #
630
+ # Cucumber::Messages::Pickle.from_h(some_hash) # => #<Cucumber::Messages::Pickle:0x... ...>
631
+ #
632
+
633
+ def self.from_h(hash)
634
+ return nil if hash.nil?
635
+
636
+ self.new(
637
+ id: hash[:id],
638
+ uri: hash[:uri],
639
+ name: hash[:name],
640
+ language: hash[:language],
641
+ steps: hash[:steps]&.map { |item| PickleStep.from_h(item) },
642
+ tags: hash[:tags]&.map { |item| PickleTag.from_h(item) },
643
+ ast_node_ids: hash[:astNodeIds],
644
+ )
645
+ end
646
+ end
647
+
648
+ class PickleDocString
649
+
650
+ ##
651
+ # Returns a new PickleDocString from the given hash.
652
+ # If the hash keys are camelCased, they are properly assigned to the
653
+ # corresponding snake_cased attributes.
654
+ #
655
+ # Cucumber::Messages::PickleDocString.from_h(some_hash) # => #<Cucumber::Messages::PickleDocString:0x... ...>
656
+ #
657
+
658
+ def self.from_h(hash)
659
+ return nil if hash.nil?
660
+
661
+ self.new(
662
+ media_type: hash[:mediaType],
663
+ content: hash[:content],
664
+ )
665
+ end
666
+ end
667
+
668
+ class PickleStep
669
+
670
+ ##
671
+ # Returns a new PickleStep from the given hash.
672
+ # If the hash keys are camelCased, they are properly assigned to the
673
+ # corresponding snake_cased attributes.
674
+ #
675
+ # Cucumber::Messages::PickleStep.from_h(some_hash) # => #<Cucumber::Messages::PickleStep:0x... ...>
676
+ #
677
+
678
+ def self.from_h(hash)
679
+ return nil if hash.nil?
680
+
681
+ self.new(
682
+ argument: PickleStepArgument.from_h(hash[:argument]),
683
+ ast_node_ids: hash[:astNodeIds],
684
+ id: hash[:id],
685
+ type: hash[:type],
686
+ text: hash[:text],
687
+ )
688
+ end
689
+ end
690
+
691
+ class PickleStepArgument
692
+
693
+ ##
694
+ # Returns a new PickleStepArgument from the given hash.
695
+ # If the hash keys are camelCased, they are properly assigned to the
696
+ # corresponding snake_cased attributes.
697
+ #
698
+ # Cucumber::Messages::PickleStepArgument.from_h(some_hash) # => #<Cucumber::Messages::PickleStepArgument:0x... ...>
699
+ #
700
+
701
+ def self.from_h(hash)
702
+ return nil if hash.nil?
703
+
704
+ self.new(
705
+ doc_string: PickleDocString.from_h(hash[:docString]),
706
+ data_table: PickleTable.from_h(hash[:dataTable]),
707
+ )
708
+ end
709
+ end
710
+
711
+ class PickleTable
712
+
713
+ ##
714
+ # Returns a new PickleTable from the given hash.
715
+ # If the hash keys are camelCased, they are properly assigned to the
716
+ # corresponding snake_cased attributes.
717
+ #
718
+ # Cucumber::Messages::PickleTable.from_h(some_hash) # => #<Cucumber::Messages::PickleTable:0x... ...>
719
+ #
720
+
721
+ def self.from_h(hash)
722
+ return nil if hash.nil?
723
+
724
+ self.new(
725
+ rows: hash[:rows]&.map { |item| PickleTableRow.from_h(item) },
726
+ )
727
+ end
728
+ end
729
+
730
+ class PickleTableCell
731
+
732
+ ##
733
+ # Returns a new PickleTableCell from the given hash.
734
+ # If the hash keys are camelCased, they are properly assigned to the
735
+ # corresponding snake_cased attributes.
736
+ #
737
+ # Cucumber::Messages::PickleTableCell.from_h(some_hash) # => #<Cucumber::Messages::PickleTableCell:0x... ...>
738
+ #
739
+
740
+ def self.from_h(hash)
741
+ return nil if hash.nil?
742
+
743
+ self.new(
744
+ value: hash[:value],
745
+ )
746
+ end
747
+ end
748
+
749
+ class PickleTableRow
750
+
751
+ ##
752
+ # Returns a new PickleTableRow from the given hash.
753
+ # If the hash keys are camelCased, they are properly assigned to the
754
+ # corresponding snake_cased attributes.
755
+ #
756
+ # Cucumber::Messages::PickleTableRow.from_h(some_hash) # => #<Cucumber::Messages::PickleTableRow:0x... ...>
757
+ #
758
+
759
+ def self.from_h(hash)
760
+ return nil if hash.nil?
761
+
762
+ self.new(
763
+ cells: hash[:cells]&.map { |item| PickleTableCell.from_h(item) },
764
+ )
765
+ end
766
+ end
767
+
768
+ class PickleTag
769
+
770
+ ##
771
+ # Returns a new PickleTag from the given hash.
772
+ # If the hash keys are camelCased, they are properly assigned to the
773
+ # corresponding snake_cased attributes.
774
+ #
775
+ # Cucumber::Messages::PickleTag.from_h(some_hash) # => #<Cucumber::Messages::PickleTag:0x... ...>
776
+ #
777
+
778
+ def self.from_h(hash)
779
+ return nil if hash.nil?
780
+
781
+ self.new(
782
+ name: hash[:name],
783
+ ast_node_id: hash[:astNodeId],
784
+ )
785
+ end
786
+ end
787
+
788
+ class Source
789
+
790
+ ##
791
+ # Returns a new Source from the given hash.
792
+ # If the hash keys are camelCased, they are properly assigned to the
793
+ # corresponding snake_cased attributes.
794
+ #
795
+ # Cucumber::Messages::Source.from_h(some_hash) # => #<Cucumber::Messages::Source:0x... ...>
796
+ #
797
+
798
+ def self.from_h(hash)
799
+ return nil if hash.nil?
800
+
801
+ self.new(
802
+ uri: hash[:uri],
803
+ data: hash[:data],
804
+ media_type: hash[:mediaType],
805
+ )
806
+ end
807
+ end
808
+
809
+ class SourceReference
810
+
811
+ ##
812
+ # Returns a new SourceReference from the given hash.
813
+ # If the hash keys are camelCased, they are properly assigned to the
814
+ # corresponding snake_cased attributes.
815
+ #
816
+ # Cucumber::Messages::SourceReference.from_h(some_hash) # => #<Cucumber::Messages::SourceReference:0x... ...>
817
+ #
818
+
819
+ def self.from_h(hash)
820
+ return nil if hash.nil?
821
+
822
+ self.new(
823
+ uri: hash[:uri],
824
+ java_method: JavaMethod.from_h(hash[:javaMethod]),
825
+ java_stack_trace_element: JavaStackTraceElement.from_h(hash[:javaStackTraceElement]),
826
+ location: Location.from_h(hash[:location]),
827
+ )
828
+ end
829
+ end
830
+
831
+ class JavaMethod
832
+
833
+ ##
834
+ # Returns a new JavaMethod from the given hash.
835
+ # If the hash keys are camelCased, they are properly assigned to the
836
+ # corresponding snake_cased attributes.
837
+ #
838
+ # Cucumber::Messages::JavaMethod.from_h(some_hash) # => #<Cucumber::Messages::JavaMethod:0x... ...>
839
+ #
840
+
841
+ def self.from_h(hash)
842
+ return nil if hash.nil?
843
+
844
+ self.new(
845
+ class_name: hash[:className],
846
+ method_name: hash[:methodName],
847
+ method_parameter_types: hash[:methodParameterTypes],
848
+ )
849
+ end
850
+ end
851
+
852
+ class JavaStackTraceElement
853
+
854
+ ##
855
+ # Returns a new JavaStackTraceElement from the given hash.
856
+ # If the hash keys are camelCased, they are properly assigned to the
857
+ # corresponding snake_cased attributes.
858
+ #
859
+ # Cucumber::Messages::JavaStackTraceElement.from_h(some_hash) # => #<Cucumber::Messages::JavaStackTraceElement:0x... ...>
860
+ #
861
+
862
+ def self.from_h(hash)
863
+ return nil if hash.nil?
864
+
865
+ self.new(
866
+ class_name: hash[:className],
867
+ file_name: hash[:fileName],
868
+ method_name: hash[:methodName],
869
+ )
870
+ end
871
+ end
872
+
873
+ class StepDefinition
874
+
875
+ ##
876
+ # Returns a new StepDefinition from the given hash.
877
+ # If the hash keys are camelCased, they are properly assigned to the
878
+ # corresponding snake_cased attributes.
879
+ #
880
+ # Cucumber::Messages::StepDefinition.from_h(some_hash) # => #<Cucumber::Messages::StepDefinition:0x... ...>
881
+ #
882
+
883
+ def self.from_h(hash)
884
+ return nil if hash.nil?
885
+
886
+ self.new(
887
+ id: hash[:id],
888
+ pattern: StepDefinitionPattern.from_h(hash[:pattern]),
889
+ source_reference: SourceReference.from_h(hash[:sourceReference]),
890
+ )
891
+ end
892
+ end
893
+
894
+ class StepDefinitionPattern
895
+
896
+ ##
897
+ # Returns a new StepDefinitionPattern from the given hash.
898
+ # If the hash keys are camelCased, they are properly assigned to the
899
+ # corresponding snake_cased attributes.
900
+ #
901
+ # Cucumber::Messages::StepDefinitionPattern.from_h(some_hash) # => #<Cucumber::Messages::StepDefinitionPattern:0x... ...>
902
+ #
903
+
904
+ def self.from_h(hash)
905
+ return nil if hash.nil?
906
+
907
+ self.new(
908
+ source: hash[:source],
909
+ type: hash[:type],
910
+ )
911
+ end
912
+ end
913
+
914
+ class TestCase
915
+
916
+ ##
917
+ # Returns a new TestCase from the given hash.
918
+ # If the hash keys are camelCased, they are properly assigned to the
919
+ # corresponding snake_cased attributes.
920
+ #
921
+ # Cucumber::Messages::TestCase.from_h(some_hash) # => #<Cucumber::Messages::TestCase:0x... ...>
922
+ #
923
+
924
+ def self.from_h(hash)
925
+ return nil if hash.nil?
926
+
927
+ self.new(
928
+ id: hash[:id],
929
+ pickle_id: hash[:pickleId],
930
+ test_steps: hash[:testSteps]&.map { |item| TestStep.from_h(item) },
931
+ )
932
+ end
933
+ end
934
+
935
+ class Group
936
+
937
+ ##
938
+ # Returns a new Group from the given hash.
939
+ # If the hash keys are camelCased, they are properly assigned to the
940
+ # corresponding snake_cased attributes.
941
+ #
942
+ # Cucumber::Messages::Group.from_h(some_hash) # => #<Cucumber::Messages::Group:0x... ...>
943
+ #
944
+
945
+ def self.from_h(hash)
946
+ return nil if hash.nil?
947
+
948
+ self.new(
949
+ children: hash[:children]&.map { |item| Group.from_h(item) },
950
+ start: hash[:start],
951
+ value: hash[:value],
952
+ )
953
+ end
954
+ end
955
+
956
+ class StepMatchArgument
957
+
958
+ ##
959
+ # Returns a new StepMatchArgument from the given hash.
960
+ # If the hash keys are camelCased, they are properly assigned to the
961
+ # corresponding snake_cased attributes.
962
+ #
963
+ # Cucumber::Messages::StepMatchArgument.from_h(some_hash) # => #<Cucumber::Messages::StepMatchArgument:0x... ...>
964
+ #
965
+
966
+ def self.from_h(hash)
967
+ return nil if hash.nil?
968
+
969
+ self.new(
970
+ group: Group.from_h(hash[:group]),
971
+ parameter_type_name: hash[:parameterTypeName],
972
+ )
973
+ end
974
+ end
975
+
976
+ class StepMatchArgumentsList
977
+
978
+ ##
979
+ # Returns a new StepMatchArgumentsList from the given hash.
980
+ # If the hash keys are camelCased, they are properly assigned to the
981
+ # corresponding snake_cased attributes.
982
+ #
983
+ # Cucumber::Messages::StepMatchArgumentsList.from_h(some_hash) # => #<Cucumber::Messages::StepMatchArgumentsList:0x... ...>
984
+ #
985
+
986
+ def self.from_h(hash)
987
+ return nil if hash.nil?
988
+
989
+ self.new(
990
+ step_match_arguments: hash[:stepMatchArguments]&.map { |item| StepMatchArgument.from_h(item) },
991
+ )
992
+ end
993
+ end
994
+
995
+ class TestStep
996
+
997
+ ##
998
+ # Returns a new TestStep from the given hash.
999
+ # If the hash keys are camelCased, they are properly assigned to the
1000
+ # corresponding snake_cased attributes.
1001
+ #
1002
+ # Cucumber::Messages::TestStep.from_h(some_hash) # => #<Cucumber::Messages::TestStep:0x... ...>
1003
+ #
1004
+
1005
+ def self.from_h(hash)
1006
+ return nil if hash.nil?
1007
+
1008
+ self.new(
1009
+ hook_id: hash[:hookId],
1010
+ id: hash[:id],
1011
+ pickle_step_id: hash[:pickleStepId],
1012
+ step_definition_ids: hash[:stepDefinitionIds],
1013
+ step_match_arguments_lists: hash[:stepMatchArgumentsLists]&.map { |item| StepMatchArgumentsList.from_h(item) },
1014
+ )
1015
+ end
1016
+ end
1017
+
1018
+ class TestCaseFinished
1019
+
1020
+ ##
1021
+ # Returns a new TestCaseFinished from the given hash.
1022
+ # If the hash keys are camelCased, they are properly assigned to the
1023
+ # corresponding snake_cased attributes.
1024
+ #
1025
+ # Cucumber::Messages::TestCaseFinished.from_h(some_hash) # => #<Cucumber::Messages::TestCaseFinished:0x... ...>
1026
+ #
1027
+
1028
+ def self.from_h(hash)
1029
+ return nil if hash.nil?
1030
+
1031
+ self.new(
1032
+ test_case_started_id: hash[:testCaseStartedId],
1033
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1034
+ will_be_retried: hash[:willBeRetried],
1035
+ )
1036
+ end
1037
+ end
1038
+
1039
+ class TestCaseStarted
1040
+
1041
+ ##
1042
+ # Returns a new TestCaseStarted from the given hash.
1043
+ # If the hash keys are camelCased, they are properly assigned to the
1044
+ # corresponding snake_cased attributes.
1045
+ #
1046
+ # Cucumber::Messages::TestCaseStarted.from_h(some_hash) # => #<Cucumber::Messages::TestCaseStarted:0x... ...>
1047
+ #
1048
+
1049
+ def self.from_h(hash)
1050
+ return nil if hash.nil?
1051
+
1052
+ self.new(
1053
+ attempt: hash[:attempt],
1054
+ id: hash[:id],
1055
+ test_case_id: hash[:testCaseId],
1056
+ worker_id: hash[:workerId],
1057
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1058
+ )
1059
+ end
1060
+ end
1061
+
1062
+ class TestRunFinished
1063
+
1064
+ ##
1065
+ # Returns a new TestRunFinished from the given hash.
1066
+ # If the hash keys are camelCased, they are properly assigned to the
1067
+ # corresponding snake_cased attributes.
1068
+ #
1069
+ # Cucumber::Messages::TestRunFinished.from_h(some_hash) # => #<Cucumber::Messages::TestRunFinished:0x... ...>
1070
+ #
1071
+
1072
+ def self.from_h(hash)
1073
+ return nil if hash.nil?
1074
+
1075
+ self.new(
1076
+ message: hash[:message],
1077
+ success: hash[:success],
1078
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1079
+ exception: Exception.from_h(hash[:exception]),
1080
+ )
1081
+ end
1082
+ end
1083
+
1084
+ class TestRunStarted
1085
+
1086
+ ##
1087
+ # Returns a new TestRunStarted from the given hash.
1088
+ # If the hash keys are camelCased, they are properly assigned to the
1089
+ # corresponding snake_cased attributes.
1090
+ #
1091
+ # Cucumber::Messages::TestRunStarted.from_h(some_hash) # => #<Cucumber::Messages::TestRunStarted:0x... ...>
1092
+ #
1093
+
1094
+ def self.from_h(hash)
1095
+ return nil if hash.nil?
1096
+
1097
+ self.new(
1098
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1099
+ )
1100
+ end
1101
+ end
1102
+
1103
+ class TestStepFinished
1104
+
1105
+ ##
1106
+ # Returns a new TestStepFinished from the given hash.
1107
+ # If the hash keys are camelCased, they are properly assigned to the
1108
+ # corresponding snake_cased attributes.
1109
+ #
1110
+ # Cucumber::Messages::TestStepFinished.from_h(some_hash) # => #<Cucumber::Messages::TestStepFinished:0x... ...>
1111
+ #
1112
+
1113
+ def self.from_h(hash)
1114
+ return nil if hash.nil?
1115
+
1116
+ self.new(
1117
+ test_case_started_id: hash[:testCaseStartedId],
1118
+ test_step_id: hash[:testStepId],
1119
+ test_step_result: TestStepResult.from_h(hash[:testStepResult]),
1120
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1121
+ )
1122
+ end
1123
+ end
1124
+
1125
+ class TestStepResult
1126
+
1127
+ ##
1128
+ # Returns a new TestStepResult from the given hash.
1129
+ # If the hash keys are camelCased, they are properly assigned to the
1130
+ # corresponding snake_cased attributes.
1131
+ #
1132
+ # Cucumber::Messages::TestStepResult.from_h(some_hash) # => #<Cucumber::Messages::TestStepResult:0x... ...>
1133
+ #
1134
+
1135
+ def self.from_h(hash)
1136
+ return nil if hash.nil?
1137
+
1138
+ self.new(
1139
+ duration: Duration.from_h(hash[:duration]),
1140
+ message: hash[:message],
1141
+ status: hash[:status],
1142
+ exception: Exception.from_h(hash[:exception]),
1143
+ )
1144
+ end
1145
+ end
1146
+
1147
+ class TestStepStarted
1148
+
1149
+ ##
1150
+ # Returns a new TestStepStarted from the given hash.
1151
+ # If the hash keys are camelCased, they are properly assigned to the
1152
+ # corresponding snake_cased attributes.
1153
+ #
1154
+ # Cucumber::Messages::TestStepStarted.from_h(some_hash) # => #<Cucumber::Messages::TestStepStarted:0x... ...>
1155
+ #
1156
+
1157
+ def self.from_h(hash)
1158
+ return nil if hash.nil?
1159
+
1160
+ self.new(
1161
+ test_case_started_id: hash[:testCaseStartedId],
1162
+ test_step_id: hash[:testStepId],
1163
+ timestamp: Timestamp.from_h(hash[:timestamp]),
1164
+ )
1165
+ end
1166
+ end
1167
+
1168
+ class Timestamp
1169
+
1170
+ ##
1171
+ # Returns a new Timestamp from the given hash.
1172
+ # If the hash keys are camelCased, they are properly assigned to the
1173
+ # corresponding snake_cased attributes.
1174
+ #
1175
+ # Cucumber::Messages::Timestamp.from_h(some_hash) # => #<Cucumber::Messages::Timestamp:0x... ...>
1176
+ #
1177
+
1178
+ def self.from_h(hash)
1179
+ return nil if hash.nil?
1180
+
1181
+ self.new(
1182
+ seconds: hash[:seconds],
1183
+ nanos: hash[:nanos],
1184
+ )
1185
+ end
1186
+ end
1187
+
1188
+ class UndefinedParameterType
1189
+
1190
+ ##
1191
+ # Returns a new UndefinedParameterType from the given hash.
1192
+ # If the hash keys are camelCased, they are properly assigned to the
1193
+ # corresponding snake_cased attributes.
1194
+ #
1195
+ # Cucumber::Messages::UndefinedParameterType.from_h(some_hash) # => #<Cucumber::Messages::UndefinedParameterType:0x... ...>
1196
+ #
1197
+
1198
+ def self.from_h(hash)
1199
+ return nil if hash.nil?
1200
+
1201
+ self.new(
1202
+ expression: hash[:expression],
1203
+ name: hash[:name],
1204
+ )
1205
+ end
1206
+ end
1207
+ end
1208
+ end