scjson 0.3.5 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/scjson/child_order.rb +95 -0
- data/lib/scjson/engine/context.rb +95 -127
- data/lib/scjson/engine.rb +9 -3
- data/lib/scjson/types.rb +220 -64
- data/lib/scjson/version.rb +1 -1
- data/lib/scjson.rb +209 -30
- metadata +3 -2
data/lib/scjson/types.rb
CHANGED
|
@@ -11,7 +11,7 @@ require 'json'
|
|
|
11
11
|
# Canonical Ruby representations of the scjson schema.
|
|
12
12
|
module Scjson
|
|
13
13
|
module Types
|
|
14
|
-
# The assign type that allows for precise manipulation of the datamodel
|
|
14
|
+
# The assign type that allows for precise manipulation of the datamodel location. Types are: replacechildren (default), firstchild, lastchild, previoussibling, nextsibling, replace, delete, addattribute
|
|
15
15
|
module AssignTypeDatatypeProps
|
|
16
16
|
REPLACECHILDREN = 'replacechildren'.freeze
|
|
17
17
|
FIRSTCHILD = 'firstchild'.freeze
|
|
@@ -119,7 +119,7 @@ module Scjson
|
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
# Describes the processor execution mode for this document, being either "lax" or
|
|
122
|
+
# Describes the processor execution mode for this document, being either "lax" or "strict".
|
|
123
123
|
module ExmodeDatatypeProps
|
|
124
124
|
LAX = 'lax'.freeze
|
|
125
125
|
STRICT = 'strict'.freeze
|
|
@@ -224,7 +224,7 @@ module Scjson
|
|
|
224
224
|
|
|
225
225
|
# update a datamodel location with an expression or value.
|
|
226
226
|
class AssignProps
|
|
227
|
-
attr_accessor :location, :expr, :type_value, :attr, :other_attributes, :content
|
|
227
|
+
attr_accessor :location, :expr, :type_value, :attr, :other_attributes, :help_text, :content
|
|
228
228
|
# Instantiate a new AssignProps object.
|
|
229
229
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
230
230
|
def initialize(**kwargs)
|
|
@@ -233,6 +233,7 @@ module Scjson
|
|
|
233
233
|
@type_value = kwargs.fetch(:type_value, AssignTypeDatatypeProps::REPLACECHILDREN)
|
|
234
234
|
@attr = kwargs.fetch(:attr, nil)
|
|
235
235
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
236
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
236
237
|
@content = kwargs.fetch(:content, [])
|
|
237
238
|
end
|
|
238
239
|
|
|
@@ -249,6 +250,7 @@ module Scjson
|
|
|
249
250
|
kwargs[:type_value] = AssignTypeDatatypeProps.coerce(normalized.fetch('type_value', AssignTypeDatatypeProps::REPLACECHILDREN))
|
|
250
251
|
kwargs[:attr] = normalized.fetch('attr', nil)
|
|
251
252
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
253
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
252
254
|
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
253
255
|
new(**kwargs)
|
|
254
256
|
end
|
|
@@ -270,6 +272,7 @@ module Scjson
|
|
|
270
272
|
'type_value' => @type_value,
|
|
271
273
|
'attr' => @attr,
|
|
272
274
|
'other_attributes' => @other_attributes,
|
|
275
|
+
'help_text' => @help_text,
|
|
273
276
|
'content' => @content
|
|
274
277
|
}
|
|
275
278
|
end
|
|
@@ -287,7 +290,7 @@ module Scjson
|
|
|
287
290
|
|
|
288
291
|
# cancel a pending `<send>` operation.
|
|
289
292
|
class CancelProps
|
|
290
|
-
attr_accessor :other_element, :sendid, :sendidexpr, :other_attributes
|
|
293
|
+
attr_accessor :other_element, :sendid, :sendidexpr, :other_attributes, :help_text
|
|
291
294
|
# Instantiate a new CancelProps object.
|
|
292
295
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
293
296
|
def initialize(**kwargs)
|
|
@@ -295,6 +298,7 @@ module Scjson
|
|
|
295
298
|
@sendid = kwargs.fetch(:sendid, nil)
|
|
296
299
|
@sendidexpr = kwargs.fetch(:sendidexpr, nil)
|
|
297
300
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
301
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
298
302
|
end
|
|
299
303
|
|
|
300
304
|
# Build an instance from a Hash representation.
|
|
@@ -309,6 +313,7 @@ module Scjson
|
|
|
309
313
|
kwargs[:sendid] = normalized.fetch('sendid', nil)
|
|
310
314
|
kwargs[:sendidexpr] = normalized.fetch('sendidexpr', nil)
|
|
311
315
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
316
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
312
317
|
new(**kwargs)
|
|
313
318
|
end
|
|
314
319
|
|
|
@@ -327,7 +332,8 @@ module Scjson
|
|
|
327
332
|
'other_element' => @other_element,
|
|
328
333
|
'sendid' => @sendid,
|
|
329
334
|
'sendidexpr' => @sendidexpr,
|
|
330
|
-
'other_attributes' => @other_attributes
|
|
335
|
+
'other_attributes' => @other_attributes,
|
|
336
|
+
'help_text' => @help_text
|
|
331
337
|
}
|
|
332
338
|
end
|
|
333
339
|
|
|
@@ -344,13 +350,14 @@ module Scjson
|
|
|
344
350
|
|
|
345
351
|
# Structured type for scjson elements.
|
|
346
352
|
class ContentProps
|
|
347
|
-
attr_accessor :content, :expr, :other_attributes
|
|
353
|
+
attr_accessor :content, :expr, :other_attributes, :help_text
|
|
348
354
|
# Instantiate a new ContentProps object.
|
|
349
355
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
350
356
|
def initialize(**kwargs)
|
|
351
357
|
@content = kwargs.fetch(:content, nil)
|
|
352
358
|
@expr = kwargs.fetch(:expr, nil)
|
|
353
359
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
360
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
354
361
|
end
|
|
355
362
|
|
|
356
363
|
# Build an instance from a Hash representation.
|
|
@@ -363,10 +370,11 @@ module Scjson
|
|
|
363
370
|
kwargs = {}
|
|
364
371
|
kwargs[:content] = begin
|
|
365
372
|
value = normalized.fetch('content', nil)
|
|
366
|
-
value.nil? ? nil : Array(value)
|
|
373
|
+
value.nil? ? nil : Array(value)
|
|
367
374
|
end
|
|
368
375
|
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
369
376
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
377
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
370
378
|
new(**kwargs)
|
|
371
379
|
end
|
|
372
380
|
|
|
@@ -382,9 +390,10 @@ module Scjson
|
|
|
382
390
|
# @return [Hash]
|
|
383
391
|
def to_hash
|
|
384
392
|
{
|
|
385
|
-
'content' =>
|
|
393
|
+
'content' => @content,
|
|
386
394
|
'expr' => @expr,
|
|
387
|
-
'other_attributes' => @other_attributes
|
|
395
|
+
'other_attributes' => @other_attributes,
|
|
396
|
+
'help_text' => @help_text
|
|
388
397
|
}
|
|
389
398
|
end
|
|
390
399
|
|
|
@@ -401,7 +410,7 @@ module Scjson
|
|
|
401
410
|
|
|
402
411
|
# represents a single datamodel variable.
|
|
403
412
|
class DataProps
|
|
404
|
-
attr_accessor :id, :src, :expr, :other_attributes, :content
|
|
413
|
+
attr_accessor :id, :src, :expr, :other_attributes, :help_text, :content
|
|
405
414
|
# Instantiate a new DataProps object.
|
|
406
415
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
407
416
|
def initialize(**kwargs)
|
|
@@ -409,6 +418,7 @@ module Scjson
|
|
|
409
418
|
@src = kwargs.fetch(:src, nil)
|
|
410
419
|
@expr = kwargs.fetch(:expr, nil)
|
|
411
420
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
421
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
412
422
|
@content = kwargs.fetch(:content, [])
|
|
413
423
|
end
|
|
414
424
|
|
|
@@ -424,6 +434,7 @@ module Scjson
|
|
|
424
434
|
kwargs[:src] = normalized.fetch('src', nil)
|
|
425
435
|
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
426
436
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
437
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
427
438
|
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
428
439
|
new(**kwargs)
|
|
429
440
|
end
|
|
@@ -444,6 +455,7 @@ module Scjson
|
|
|
444
455
|
'src' => @src,
|
|
445
456
|
'expr' => @expr,
|
|
446
457
|
'other_attributes' => @other_attributes,
|
|
458
|
+
'help_text' => @help_text,
|
|
447
459
|
'content' => @content
|
|
448
460
|
}
|
|
449
461
|
end
|
|
@@ -461,13 +473,14 @@ module Scjson
|
|
|
461
473
|
|
|
462
474
|
# container for one or more `<data>` elements.
|
|
463
475
|
class DatamodelProps
|
|
464
|
-
attr_accessor :data, :other_element, :other_attributes
|
|
476
|
+
attr_accessor :data, :other_element, :other_attributes, :help_text
|
|
465
477
|
# Instantiate a new DatamodelProps object.
|
|
466
478
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
467
479
|
def initialize(**kwargs)
|
|
468
480
|
@data = kwargs.fetch(:data, [])
|
|
469
481
|
@other_element = kwargs.fetch(:other_element, [])
|
|
470
482
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
483
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
471
484
|
end
|
|
472
485
|
|
|
473
486
|
# Build an instance from a Hash representation.
|
|
@@ -481,6 +494,7 @@ module Scjson
|
|
|
481
494
|
kwargs[:data] = Array(normalized.fetch('data', [])).map { |item| DataProps.from_hash(item) }
|
|
482
495
|
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
483
496
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
497
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
484
498
|
new(**kwargs)
|
|
485
499
|
end
|
|
486
500
|
|
|
@@ -498,7 +512,8 @@ module Scjson
|
|
|
498
512
|
{
|
|
499
513
|
'data' => (@data || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
500
514
|
'other_element' => @other_element,
|
|
501
|
-
'other_attributes' => @other_attributes
|
|
515
|
+
'other_attributes' => @other_attributes,
|
|
516
|
+
'help_text' => @help_text
|
|
502
517
|
}
|
|
503
518
|
end
|
|
504
519
|
|
|
@@ -515,13 +530,14 @@ module Scjson
|
|
|
515
530
|
|
|
516
531
|
# Structured type for scjson elements.
|
|
517
532
|
class DonedataProps
|
|
518
|
-
attr_accessor :content, :param, :other_attributes
|
|
533
|
+
attr_accessor :content, :param, :other_attributes, :help_text
|
|
519
534
|
# Instantiate a new DonedataProps object.
|
|
520
535
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
521
536
|
def initialize(**kwargs)
|
|
522
537
|
@content = kwargs.fetch(:content, nil)
|
|
523
538
|
@param = kwargs.fetch(:param, [])
|
|
524
539
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
540
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
525
541
|
end
|
|
526
542
|
|
|
527
543
|
# Build an instance from a Hash representation.
|
|
@@ -535,6 +551,7 @@ module Scjson
|
|
|
535
551
|
kwargs[:content] = normalized.key?('content') && normalized['content'] ? ContentProps.from_hash(normalized['content']) : nil
|
|
536
552
|
kwargs[:param] = Array(normalized.fetch('param', [])).map { |item| ParamProps.from_hash(item) }
|
|
537
553
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
554
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
538
555
|
new(**kwargs)
|
|
539
556
|
end
|
|
540
557
|
|
|
@@ -552,7 +569,8 @@ module Scjson
|
|
|
552
569
|
{
|
|
553
570
|
'content' => @content&.to_hash,
|
|
554
571
|
'param' => (@param || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
555
|
-
'other_attributes' => @other_attributes
|
|
572
|
+
'other_attributes' => @other_attributes,
|
|
573
|
+
'help_text' => @help_text
|
|
556
574
|
}
|
|
557
575
|
end
|
|
558
576
|
|
|
@@ -569,11 +587,12 @@ module Scjson
|
|
|
569
587
|
|
|
570
588
|
# fallback branch for `<if>` conditions.
|
|
571
589
|
class ElseProps
|
|
572
|
-
attr_accessor :other_attributes
|
|
590
|
+
attr_accessor :other_attributes, :help_text
|
|
573
591
|
# Instantiate a new ElseProps object.
|
|
574
592
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
575
593
|
def initialize(**kwargs)
|
|
576
594
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
595
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
577
596
|
end
|
|
578
597
|
|
|
579
598
|
# Build an instance from a Hash representation.
|
|
@@ -585,6 +604,7 @@ module Scjson
|
|
|
585
604
|
normalized = data.transform_keys(&:to_s)
|
|
586
605
|
kwargs = {}
|
|
587
606
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
607
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
588
608
|
new(**kwargs)
|
|
589
609
|
end
|
|
590
610
|
|
|
@@ -600,7 +620,8 @@ module Scjson
|
|
|
600
620
|
# @return [Hash]
|
|
601
621
|
def to_hash
|
|
602
622
|
{
|
|
603
|
-
'other_attributes' => @other_attributes
|
|
623
|
+
'other_attributes' => @other_attributes,
|
|
624
|
+
'help_text' => @help_text
|
|
604
625
|
}
|
|
605
626
|
end
|
|
606
627
|
|
|
@@ -614,12 +635,13 @@ module Scjson
|
|
|
614
635
|
|
|
615
636
|
# conditional branch following an `<if>`.
|
|
616
637
|
class ElseifProps
|
|
617
|
-
attr_accessor :cond, :other_attributes
|
|
638
|
+
attr_accessor :cond, :other_attributes, :help_text
|
|
618
639
|
# Instantiate a new ElseifProps object.
|
|
619
640
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
620
641
|
def initialize(**kwargs)
|
|
621
642
|
@cond = kwargs.fetch(:cond, '')
|
|
622
643
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
644
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
623
645
|
end
|
|
624
646
|
|
|
625
647
|
# Build an instance from a Hash representation.
|
|
@@ -632,6 +654,7 @@ module Scjson
|
|
|
632
654
|
kwargs = {}
|
|
633
655
|
kwargs[:cond] = normalized.fetch('cond', '')
|
|
634
656
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
657
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
635
658
|
new(**kwargs)
|
|
636
659
|
end
|
|
637
660
|
|
|
@@ -648,7 +671,8 @@ module Scjson
|
|
|
648
671
|
def to_hash
|
|
649
672
|
{
|
|
650
673
|
'cond' => @cond,
|
|
651
|
-
'other_attributes' => @other_attributes
|
|
674
|
+
'other_attributes' => @other_attributes,
|
|
675
|
+
'help_text' => @help_text
|
|
652
676
|
}
|
|
653
677
|
end
|
|
654
678
|
|
|
@@ -662,7 +686,7 @@ module Scjson
|
|
|
662
686
|
|
|
663
687
|
# Structured type for scjson elements.
|
|
664
688
|
class FinalProps
|
|
665
|
-
attr_accessor :onentry, :onexit, :donedata, :other_element, :id, :other_attributes
|
|
689
|
+
attr_accessor :onentry, :onexit, :donedata, :other_element, :id, :other_attributes, :help_text
|
|
666
690
|
# Instantiate a new FinalProps object.
|
|
667
691
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
668
692
|
def initialize(**kwargs)
|
|
@@ -672,6 +696,7 @@ module Scjson
|
|
|
672
696
|
@other_element = kwargs.fetch(:other_element, [])
|
|
673
697
|
@id = kwargs.fetch(:id, nil)
|
|
674
698
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
699
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
675
700
|
end
|
|
676
701
|
|
|
677
702
|
# Build an instance from a Hash representation.
|
|
@@ -688,6 +713,7 @@ module Scjson
|
|
|
688
713
|
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
689
714
|
kwargs[:id] = normalized.fetch('id', nil)
|
|
690
715
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
716
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
691
717
|
new(**kwargs)
|
|
692
718
|
end
|
|
693
719
|
|
|
@@ -708,7 +734,8 @@ module Scjson
|
|
|
708
734
|
'donedata' => (@donedata || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
709
735
|
'other_element' => @other_element,
|
|
710
736
|
'id' => @id,
|
|
711
|
-
'other_attributes' => @other_attributes
|
|
737
|
+
'other_attributes' => @other_attributes,
|
|
738
|
+
'help_text' => @help_text
|
|
712
739
|
}
|
|
713
740
|
end
|
|
714
741
|
|
|
@@ -725,7 +752,7 @@ module Scjson
|
|
|
725
752
|
|
|
726
753
|
# Structured type for scjson elements.
|
|
727
754
|
class FinalizeProps
|
|
728
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
755
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes, :help_text, :execution_order
|
|
729
756
|
# Instantiate a new FinalizeProps object.
|
|
730
757
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
731
758
|
def initialize(**kwargs)
|
|
@@ -739,6 +766,8 @@ module Scjson
|
|
|
739
766
|
@log = kwargs.fetch(:log, [])
|
|
740
767
|
@cancel = kwargs.fetch(:cancel, [])
|
|
741
768
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
769
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
770
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
742
771
|
end
|
|
743
772
|
|
|
744
773
|
# Build an instance from a Hash representation.
|
|
@@ -759,6 +788,8 @@ module Scjson
|
|
|
759
788
|
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
760
789
|
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
761
790
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
791
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
792
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
762
793
|
new(**kwargs)
|
|
763
794
|
end
|
|
764
795
|
|
|
@@ -783,8 +814,9 @@ module Scjson
|
|
|
783
814
|
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
784
815
|
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
785
816
|
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
786
|
-
'other_attributes' => @other_attributes
|
|
787
|
-
|
|
817
|
+
'other_attributes' => @other_attributes,
|
|
818
|
+
'help_text' => @help_text
|
|
819
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
788
820
|
end
|
|
789
821
|
|
|
790
822
|
# Serialize the object to JSON.
|
|
@@ -800,7 +832,7 @@ module Scjson
|
|
|
800
832
|
|
|
801
833
|
# Structured type for scjson elements.
|
|
802
834
|
class ForeachProps
|
|
803
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :array, :item, :index, :other_attributes
|
|
835
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :array, :item, :index, :other_attributes, :help_text, :execution_order
|
|
804
836
|
# Instantiate a new ForeachProps object.
|
|
805
837
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
806
838
|
def initialize(**kwargs)
|
|
@@ -817,6 +849,8 @@ module Scjson
|
|
|
817
849
|
@item = kwargs.fetch(:item, '')
|
|
818
850
|
@index = kwargs.fetch(:index, nil)
|
|
819
851
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
852
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
853
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
820
854
|
end
|
|
821
855
|
|
|
822
856
|
# Build an instance from a Hash representation.
|
|
@@ -840,6 +874,8 @@ module Scjson
|
|
|
840
874
|
kwargs[:item] = normalized.fetch('item', '')
|
|
841
875
|
kwargs[:index] = normalized.fetch('index', nil)
|
|
842
876
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
877
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
878
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
843
879
|
new(**kwargs)
|
|
844
880
|
end
|
|
845
881
|
|
|
@@ -867,8 +903,9 @@ module Scjson
|
|
|
867
903
|
'array' => @array,
|
|
868
904
|
'item' => @item,
|
|
869
905
|
'index' => @index,
|
|
870
|
-
'other_attributes' => @other_attributes
|
|
871
|
-
|
|
906
|
+
'other_attributes' => @other_attributes,
|
|
907
|
+
'help_text' => @help_text
|
|
908
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
872
909
|
end
|
|
873
910
|
|
|
874
911
|
# Serialize the object to JSON.
|
|
@@ -884,7 +921,7 @@ module Scjson
|
|
|
884
921
|
|
|
885
922
|
# Structured type for scjson elements.
|
|
886
923
|
class HistoryProps
|
|
887
|
-
attr_accessor :other_element, :transition, :id, :type_value, :other_attributes
|
|
924
|
+
attr_accessor :other_element, :transition, :id, :type_value, :other_attributes, :help_text
|
|
888
925
|
# Instantiate a new HistoryProps object.
|
|
889
926
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
890
927
|
def initialize(**kwargs)
|
|
@@ -893,6 +930,7 @@ module Scjson
|
|
|
893
930
|
@id = kwargs.fetch(:id, nil)
|
|
894
931
|
@type_value = kwargs.fetch(:type_value, nil)
|
|
895
932
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
933
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
896
934
|
end
|
|
897
935
|
|
|
898
936
|
# Build an instance from a Hash representation.
|
|
@@ -908,6 +946,7 @@ module Scjson
|
|
|
908
946
|
kwargs[:id] = normalized.fetch('id', nil)
|
|
909
947
|
kwargs[:type_value] = normalized.key?('type_value') ? HistoryTypeDatatypeProps.coerce(normalized['type_value'], allow_nil: true) : nil
|
|
910
948
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
949
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
911
950
|
new(**kwargs)
|
|
912
951
|
end
|
|
913
952
|
|
|
@@ -927,7 +966,8 @@ module Scjson
|
|
|
927
966
|
'transition' => @transition&.to_hash,
|
|
928
967
|
'id' => @id,
|
|
929
968
|
'type_value' => @type_value,
|
|
930
|
-
'other_attributes' => @other_attributes
|
|
969
|
+
'other_attributes' => @other_attributes,
|
|
970
|
+
'help_text' => @help_text
|
|
931
971
|
}
|
|
932
972
|
end
|
|
933
973
|
|
|
@@ -944,7 +984,7 @@ module Scjson
|
|
|
944
984
|
|
|
945
985
|
# Structured type for scjson elements.
|
|
946
986
|
class IfProps
|
|
947
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :elseif, :else_value, :cond, :other_attributes
|
|
987
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :elseif, :else_value, :cond, :other_attributes, :help_text, :execution_order
|
|
948
988
|
# Instantiate a new IfProps object.
|
|
949
989
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
950
990
|
def initialize(**kwargs)
|
|
@@ -961,6 +1001,8 @@ module Scjson
|
|
|
961
1001
|
@else_value = kwargs.fetch(:else_value, nil)
|
|
962
1002
|
@cond = kwargs.fetch(:cond, '')
|
|
963
1003
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1004
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1005
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
964
1006
|
end
|
|
965
1007
|
|
|
966
1008
|
# Build an instance from a Hash representation.
|
|
@@ -980,10 +1022,12 @@ module Scjson
|
|
|
980
1022
|
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
981
1023
|
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
982
1024
|
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
983
|
-
kwargs[:elseif] = normalized.
|
|
1025
|
+
kwargs[:elseif] = normalized.fetch('elseif', nil)
|
|
984
1026
|
kwargs[:else_value] = normalized.key?('else_value') && normalized['else_value'] ? ElseProps.from_hash(normalized['else_value']) : nil
|
|
985
1027
|
kwargs[:cond] = normalized.fetch('cond', '')
|
|
986
1028
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1029
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1030
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
987
1031
|
new(**kwargs)
|
|
988
1032
|
end
|
|
989
1033
|
|
|
@@ -1008,11 +1052,12 @@ module Scjson
|
|
|
1008
1052
|
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1009
1053
|
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1010
1054
|
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1011
|
-
'elseif' => @elseif
|
|
1055
|
+
'elseif' => @elseif,
|
|
1012
1056
|
'else_value' => @else_value&.to_hash,
|
|
1013
1057
|
'cond' => @cond,
|
|
1014
|
-
'other_attributes' => @other_attributes
|
|
1015
|
-
|
|
1058
|
+
'other_attributes' => @other_attributes,
|
|
1059
|
+
'help_text' => @help_text
|
|
1060
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
1016
1061
|
end
|
|
1017
1062
|
|
|
1018
1063
|
# Serialize the object to JSON.
|
|
@@ -1028,13 +1073,14 @@ module Scjson
|
|
|
1028
1073
|
|
|
1029
1074
|
# Structured type for scjson elements.
|
|
1030
1075
|
class InitialProps
|
|
1031
|
-
attr_accessor :other_element, :transition, :other_attributes
|
|
1076
|
+
attr_accessor :other_element, :transition, :other_attributes, :help_text
|
|
1032
1077
|
# Instantiate a new InitialProps object.
|
|
1033
1078
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1034
1079
|
def initialize(**kwargs)
|
|
1035
1080
|
@other_element = kwargs.fetch(:other_element, [])
|
|
1036
1081
|
@transition = kwargs.fetch(:transition, TransitionProps.new)
|
|
1037
1082
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1083
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1038
1084
|
end
|
|
1039
1085
|
|
|
1040
1086
|
# Build an instance from a Hash representation.
|
|
@@ -1048,6 +1094,7 @@ module Scjson
|
|
|
1048
1094
|
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1049
1095
|
kwargs[:transition] = normalized.key?('transition') && normalized['transition'] ? TransitionProps.from_hash(normalized['transition']) : TransitionProps.new
|
|
1050
1096
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1097
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1051
1098
|
new(**kwargs)
|
|
1052
1099
|
end
|
|
1053
1100
|
|
|
@@ -1065,7 +1112,8 @@ module Scjson
|
|
|
1065
1112
|
{
|
|
1066
1113
|
'other_element' => @other_element,
|
|
1067
1114
|
'transition' => @transition&.to_hash,
|
|
1068
|
-
'other_attributes' => @other_attributes
|
|
1115
|
+
'other_attributes' => @other_attributes,
|
|
1116
|
+
'help_text' => @help_text
|
|
1069
1117
|
}
|
|
1070
1118
|
end
|
|
1071
1119
|
|
|
@@ -1082,7 +1130,7 @@ module Scjson
|
|
|
1082
1130
|
|
|
1083
1131
|
# Structured type for scjson elements.
|
|
1084
1132
|
class InvokeProps
|
|
1085
|
-
attr_accessor :content, :param, :finalize, :other_element, :type_value, :typeexpr, :src, :srcexpr, :id, :idlocation, :namelist, :autoforward, :other_attributes
|
|
1133
|
+
attr_accessor :content, :param, :finalize, :other_element, :type_value, :typeexpr, :src, :srcexpr, :id, :idlocation, :namelist, :autoforward, :other_attributes, :help_text
|
|
1086
1134
|
# Instantiate a new InvokeProps object.
|
|
1087
1135
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1088
1136
|
def initialize(**kwargs)
|
|
@@ -1099,6 +1147,7 @@ module Scjson
|
|
|
1099
1147
|
@namelist = kwargs.fetch(:namelist, nil)
|
|
1100
1148
|
@autoforward = kwargs.fetch(:autoforward, BooleanDatatypeProps::FALSE)
|
|
1101
1149
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1150
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1102
1151
|
end
|
|
1103
1152
|
|
|
1104
1153
|
# Build an instance from a Hash representation.
|
|
@@ -1122,6 +1171,7 @@ module Scjson
|
|
|
1122
1171
|
kwargs[:namelist] = normalized.fetch('namelist', nil)
|
|
1123
1172
|
kwargs[:autoforward] = BooleanDatatypeProps.coerce(normalized.fetch('autoforward', BooleanDatatypeProps::FALSE))
|
|
1124
1173
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1174
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1125
1175
|
new(**kwargs)
|
|
1126
1176
|
end
|
|
1127
1177
|
|
|
@@ -1149,7 +1199,8 @@ module Scjson
|
|
|
1149
1199
|
'idlocation' => @idlocation,
|
|
1150
1200
|
'namelist' => @namelist,
|
|
1151
1201
|
'autoforward' => @autoforward,
|
|
1152
|
-
'other_attributes' => @other_attributes
|
|
1202
|
+
'other_attributes' => @other_attributes,
|
|
1203
|
+
'help_text' => @help_text
|
|
1153
1204
|
}
|
|
1154
1205
|
end
|
|
1155
1206
|
|
|
@@ -1166,7 +1217,7 @@ module Scjson
|
|
|
1166
1217
|
|
|
1167
1218
|
# diagnostic output statement.
|
|
1168
1219
|
class LogProps
|
|
1169
|
-
attr_accessor :other_element, :label, :expr, :other_attributes
|
|
1220
|
+
attr_accessor :other_element, :label, :expr, :other_attributes, :help_text
|
|
1170
1221
|
# Instantiate a new LogProps object.
|
|
1171
1222
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1172
1223
|
def initialize(**kwargs)
|
|
@@ -1174,6 +1225,7 @@ module Scjson
|
|
|
1174
1225
|
@label = kwargs.fetch(:label, nil)
|
|
1175
1226
|
@expr = kwargs.fetch(:expr, nil)
|
|
1176
1227
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1228
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1177
1229
|
end
|
|
1178
1230
|
|
|
1179
1231
|
# Build an instance from a Hash representation.
|
|
@@ -1188,6 +1240,7 @@ module Scjson
|
|
|
1188
1240
|
kwargs[:label] = normalized.fetch('label', nil)
|
|
1189
1241
|
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
1190
1242
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1243
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1191
1244
|
new(**kwargs)
|
|
1192
1245
|
end
|
|
1193
1246
|
|
|
@@ -1206,7 +1259,8 @@ module Scjson
|
|
|
1206
1259
|
'other_element' => @other_element,
|
|
1207
1260
|
'label' => @label,
|
|
1208
1261
|
'expr' => @expr,
|
|
1209
|
-
'other_attributes' => @other_attributes
|
|
1262
|
+
'other_attributes' => @other_attributes,
|
|
1263
|
+
'help_text' => @help_text
|
|
1210
1264
|
}
|
|
1211
1265
|
end
|
|
1212
1266
|
|
|
@@ -1223,7 +1277,7 @@ module Scjson
|
|
|
1223
1277
|
|
|
1224
1278
|
# Structured type for scjson elements.
|
|
1225
1279
|
class OnentryProps
|
|
1226
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
1280
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes, :help_text, :execution_order
|
|
1227
1281
|
# Instantiate a new OnentryProps object.
|
|
1228
1282
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1229
1283
|
def initialize(**kwargs)
|
|
@@ -1237,6 +1291,8 @@ module Scjson
|
|
|
1237
1291
|
@log = kwargs.fetch(:log, [])
|
|
1238
1292
|
@cancel = kwargs.fetch(:cancel, [])
|
|
1239
1293
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1294
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1295
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
1240
1296
|
end
|
|
1241
1297
|
|
|
1242
1298
|
# Build an instance from a Hash representation.
|
|
@@ -1257,6 +1313,8 @@ module Scjson
|
|
|
1257
1313
|
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
1258
1314
|
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
1259
1315
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1316
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1317
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
1260
1318
|
new(**kwargs)
|
|
1261
1319
|
end
|
|
1262
1320
|
|
|
@@ -1281,8 +1339,9 @@ module Scjson
|
|
|
1281
1339
|
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1282
1340
|
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1283
1341
|
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1284
|
-
'other_attributes' => @other_attributes
|
|
1285
|
-
|
|
1342
|
+
'other_attributes' => @other_attributes,
|
|
1343
|
+
'help_text' => @help_text
|
|
1344
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
1286
1345
|
end
|
|
1287
1346
|
|
|
1288
1347
|
# Serialize the object to JSON.
|
|
@@ -1298,7 +1357,7 @@ module Scjson
|
|
|
1298
1357
|
|
|
1299
1358
|
# Structured type for scjson elements.
|
|
1300
1359
|
class OnexitProps
|
|
1301
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
1360
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes, :help_text, :execution_order
|
|
1302
1361
|
# Instantiate a new OnexitProps object.
|
|
1303
1362
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1304
1363
|
def initialize(**kwargs)
|
|
@@ -1312,6 +1371,8 @@ module Scjson
|
|
|
1312
1371
|
@log = kwargs.fetch(:log, [])
|
|
1313
1372
|
@cancel = kwargs.fetch(:cancel, [])
|
|
1314
1373
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1374
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1375
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
1315
1376
|
end
|
|
1316
1377
|
|
|
1317
1378
|
# Build an instance from a Hash representation.
|
|
@@ -1332,6 +1393,8 @@ module Scjson
|
|
|
1332
1393
|
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
1333
1394
|
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
1334
1395
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1396
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1397
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
1335
1398
|
new(**kwargs)
|
|
1336
1399
|
end
|
|
1337
1400
|
|
|
@@ -1356,8 +1419,9 @@ module Scjson
|
|
|
1356
1419
|
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1357
1420
|
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1358
1421
|
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1359
|
-
'other_attributes' => @other_attributes
|
|
1360
|
-
|
|
1422
|
+
'other_attributes' => @other_attributes,
|
|
1423
|
+
'help_text' => @help_text
|
|
1424
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
1361
1425
|
end
|
|
1362
1426
|
|
|
1363
1427
|
# Serialize the object to JSON.
|
|
@@ -1373,7 +1437,7 @@ module Scjson
|
|
|
1373
1437
|
|
|
1374
1438
|
# Structured type for scjson elements.
|
|
1375
1439
|
class ParallelProps
|
|
1376
|
-
attr_accessor :onentry, :onexit, :transition, :state, :parallel, :history, :datamodel, :invoke, :other_element, :id, :other_attributes
|
|
1440
|
+
attr_accessor :onentry, :onexit, :transition, :state, :parallel, :history, :datamodel, :invoke, :other_element, :id, :other_attributes, :help_text, :region_order
|
|
1377
1441
|
# Instantiate a new ParallelProps object.
|
|
1378
1442
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1379
1443
|
def initialize(**kwargs)
|
|
@@ -1388,6 +1452,8 @@ module Scjson
|
|
|
1388
1452
|
@other_element = kwargs.fetch(:other_element, [])
|
|
1389
1453
|
@id = kwargs.fetch(:id, nil)
|
|
1390
1454
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1455
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1456
|
+
@region_order = kwargs.fetch(:region_order, nil)
|
|
1391
1457
|
end
|
|
1392
1458
|
|
|
1393
1459
|
# Build an instance from a Hash representation.
|
|
@@ -1409,6 +1475,8 @@ module Scjson
|
|
|
1409
1475
|
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1410
1476
|
kwargs[:id] = normalized.fetch('id', nil)
|
|
1411
1477
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1478
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1479
|
+
kwargs[:region_order] = normalized['region_order']
|
|
1412
1480
|
new(**kwargs)
|
|
1413
1481
|
end
|
|
1414
1482
|
|
|
@@ -1434,8 +1502,9 @@ module Scjson
|
|
|
1434
1502
|
'invoke' => (@invoke || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1435
1503
|
'other_element' => @other_element,
|
|
1436
1504
|
'id' => @id,
|
|
1437
|
-
'other_attributes' => @other_attributes
|
|
1438
|
-
|
|
1505
|
+
'other_attributes' => @other_attributes,
|
|
1506
|
+
'help_text' => @help_text
|
|
1507
|
+
}.tap { |result| result['region_order'] = @region_order unless @region_order.nil? }
|
|
1439
1508
|
end
|
|
1440
1509
|
|
|
1441
1510
|
# Serialize the object to JSON.
|
|
@@ -1451,7 +1520,7 @@ module Scjson
|
|
|
1451
1520
|
|
|
1452
1521
|
# parameter passed to `<invoke>` or `<send>`.
|
|
1453
1522
|
class ParamProps
|
|
1454
|
-
attr_accessor :other_element, :name, :expr, :location, :other_attributes
|
|
1523
|
+
attr_accessor :other_element, :name, :expr, :location, :other_attributes, :help_text
|
|
1455
1524
|
# Instantiate a new ParamProps object.
|
|
1456
1525
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1457
1526
|
def initialize(**kwargs)
|
|
@@ -1460,6 +1529,7 @@ module Scjson
|
|
|
1460
1529
|
@expr = kwargs.fetch(:expr, nil)
|
|
1461
1530
|
@location = kwargs.fetch(:location, nil)
|
|
1462
1531
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1532
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1463
1533
|
end
|
|
1464
1534
|
|
|
1465
1535
|
# Build an instance from a Hash representation.
|
|
@@ -1475,6 +1545,7 @@ module Scjson
|
|
|
1475
1545
|
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
1476
1546
|
kwargs[:location] = normalized.fetch('location', nil)
|
|
1477
1547
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1548
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1478
1549
|
new(**kwargs)
|
|
1479
1550
|
end
|
|
1480
1551
|
|
|
@@ -1494,7 +1565,8 @@ module Scjson
|
|
|
1494
1565
|
'name' => @name,
|
|
1495
1566
|
'expr' => @expr,
|
|
1496
1567
|
'location' => @location,
|
|
1497
|
-
'other_attributes' => @other_attributes
|
|
1568
|
+
'other_attributes' => @other_attributes,
|
|
1569
|
+
'help_text' => @help_text
|
|
1498
1570
|
}
|
|
1499
1571
|
end
|
|
1500
1572
|
|
|
@@ -1511,12 +1583,13 @@ module Scjson
|
|
|
1511
1583
|
|
|
1512
1584
|
# raise an internal event.
|
|
1513
1585
|
class RaiseProps
|
|
1514
|
-
attr_accessor :event, :other_attributes
|
|
1586
|
+
attr_accessor :event, :other_attributes, :help_text
|
|
1515
1587
|
# Instantiate a new RaiseProps object.
|
|
1516
1588
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1517
1589
|
def initialize(**kwargs)
|
|
1518
1590
|
@event = kwargs.fetch(:event, '')
|
|
1519
1591
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1592
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1520
1593
|
end
|
|
1521
1594
|
|
|
1522
1595
|
# Build an instance from a Hash representation.
|
|
@@ -1529,6 +1602,7 @@ module Scjson
|
|
|
1529
1602
|
kwargs = {}
|
|
1530
1603
|
kwargs[:event] = normalized.fetch('event', '')
|
|
1531
1604
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1605
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1532
1606
|
new(**kwargs)
|
|
1533
1607
|
end
|
|
1534
1608
|
|
|
@@ -1545,7 +1619,8 @@ module Scjson
|
|
|
1545
1619
|
def to_hash
|
|
1546
1620
|
{
|
|
1547
1621
|
'event' => @event,
|
|
1548
|
-
'other_attributes' => @other_attributes
|
|
1622
|
+
'other_attributes' => @other_attributes,
|
|
1623
|
+
'help_text' => @help_text
|
|
1549
1624
|
}
|
|
1550
1625
|
end
|
|
1551
1626
|
|
|
@@ -1562,12 +1637,13 @@ module Scjson
|
|
|
1562
1637
|
|
|
1563
1638
|
# inline executable script.
|
|
1564
1639
|
class ScriptProps
|
|
1565
|
-
attr_accessor :src, :other_attributes, :content
|
|
1640
|
+
attr_accessor :src, :other_attributes, :help_text, :content
|
|
1566
1641
|
# Instantiate a new ScriptProps object.
|
|
1567
1642
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1568
1643
|
def initialize(**kwargs)
|
|
1569
1644
|
@src = kwargs.fetch(:src, nil)
|
|
1570
1645
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1646
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1571
1647
|
@content = kwargs.fetch(:content, [])
|
|
1572
1648
|
end
|
|
1573
1649
|
|
|
@@ -1581,6 +1657,7 @@ module Scjson
|
|
|
1581
1657
|
kwargs = {}
|
|
1582
1658
|
kwargs[:src] = normalized.fetch('src', nil)
|
|
1583
1659
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1660
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1584
1661
|
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
1585
1662
|
new(**kwargs)
|
|
1586
1663
|
end
|
|
@@ -1599,6 +1676,7 @@ module Scjson
|
|
|
1599
1676
|
{
|
|
1600
1677
|
'src' => @src,
|
|
1601
1678
|
'other_attributes' => @other_attributes,
|
|
1679
|
+
'help_text' => @help_text,
|
|
1602
1680
|
'content' => @content
|
|
1603
1681
|
}
|
|
1604
1682
|
end
|
|
@@ -1616,7 +1694,7 @@ module Scjson
|
|
|
1616
1694
|
|
|
1617
1695
|
# Structured type for scjson elements.
|
|
1618
1696
|
class ScxmlProps
|
|
1619
|
-
attr_accessor :state, :parallel, :final, :datamodel, :script, :other_element, :initial, :name, :version, :datamodel_attribute, :binding, :exmode, :other_attributes
|
|
1697
|
+
attr_accessor :state, :parallel, :final, :datamodel, :script, :other_element, :initial, :name, :version, :datamodel_attribute, :binding, :exmode, :other_attributes, :help_text, :state_order
|
|
1620
1698
|
# Instantiate a new ScxmlProps object.
|
|
1621
1699
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1622
1700
|
def initialize(**kwargs)
|
|
@@ -1633,6 +1711,8 @@ module Scjson
|
|
|
1633
1711
|
@binding = kwargs.fetch(:binding, nil)
|
|
1634
1712
|
@exmode = kwargs.fetch(:exmode, nil)
|
|
1635
1713
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1714
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1715
|
+
@state_order = kwargs.fetch(:state_order, nil)
|
|
1636
1716
|
end
|
|
1637
1717
|
|
|
1638
1718
|
# Build an instance from a Hash representation.
|
|
@@ -1656,6 +1736,8 @@ module Scjson
|
|
|
1656
1736
|
kwargs[:binding] = normalized.key?('binding') ? BindingDatatypeProps.coerce(normalized['binding'], allow_nil: true) : nil
|
|
1657
1737
|
kwargs[:exmode] = normalized.key?('exmode') ? ExmodeDatatypeProps.coerce(normalized['exmode'], allow_nil: true) : nil
|
|
1658
1738
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1739
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1740
|
+
kwargs[:state_order] = normalized['state_order']
|
|
1659
1741
|
new(**kwargs)
|
|
1660
1742
|
end
|
|
1661
1743
|
|
|
@@ -1683,8 +1765,9 @@ module Scjson
|
|
|
1683
1765
|
'datamodel_attribute' => @datamodel_attribute,
|
|
1684
1766
|
'binding' => @binding,
|
|
1685
1767
|
'exmode' => @exmode,
|
|
1686
|
-
'other_attributes' => @other_attributes
|
|
1687
|
-
|
|
1768
|
+
'other_attributes' => @other_attributes,
|
|
1769
|
+
'help_text' => @help_text
|
|
1770
|
+
}.tap { |result| result['state_order'] = @state_order unless @state_order.nil? }
|
|
1688
1771
|
end
|
|
1689
1772
|
|
|
1690
1773
|
# Serialize the object to JSON.
|
|
@@ -1697,7 +1780,7 @@ module Scjson
|
|
|
1697
1780
|
|
|
1698
1781
|
# Structured type for scjson elements.
|
|
1699
1782
|
class SendProps
|
|
1700
|
-
attr_accessor :content, :param, :other_element, :event, :eventexpr, :target, :targetexpr, :type_value, :typeexpr, :id, :idlocation, :delay, :delayexpr, :namelist, :other_attributes
|
|
1783
|
+
attr_accessor :content, :param, :other_element, :event, :eventexpr, :target, :targetexpr, :type_value, :typeexpr, :id, :idlocation, :delay, :delayexpr, :namelist, :other_attributes, :help_text
|
|
1701
1784
|
# Instantiate a new SendProps object.
|
|
1702
1785
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1703
1786
|
def initialize(**kwargs)
|
|
@@ -1716,6 +1799,7 @@ module Scjson
|
|
|
1716
1799
|
@delayexpr = kwargs.fetch(:delayexpr, nil)
|
|
1717
1800
|
@namelist = kwargs.fetch(:namelist, nil)
|
|
1718
1801
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1802
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1719
1803
|
end
|
|
1720
1804
|
|
|
1721
1805
|
# Build an instance from a Hash representation.
|
|
@@ -1741,6 +1825,7 @@ module Scjson
|
|
|
1741
1825
|
kwargs[:delayexpr] = normalized.fetch('delayexpr', nil)
|
|
1742
1826
|
kwargs[:namelist] = normalized.fetch('namelist', nil)
|
|
1743
1827
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1828
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1744
1829
|
new(**kwargs)
|
|
1745
1830
|
end
|
|
1746
1831
|
|
|
@@ -1770,7 +1855,8 @@ module Scjson
|
|
|
1770
1855
|
'delay' => @delay,
|
|
1771
1856
|
'delayexpr' => @delayexpr,
|
|
1772
1857
|
'namelist' => @namelist,
|
|
1773
|
-
'other_attributes' => @other_attributes
|
|
1858
|
+
'other_attributes' => @other_attributes,
|
|
1859
|
+
'help_text' => @help_text
|
|
1774
1860
|
}
|
|
1775
1861
|
end
|
|
1776
1862
|
|
|
@@ -1787,7 +1873,7 @@ module Scjson
|
|
|
1787
1873
|
|
|
1788
1874
|
# Structured type for scjson elements.
|
|
1789
1875
|
class StateProps
|
|
1790
|
-
attr_accessor :onentry, :onexit, :transition, :initial, :state, :parallel, :final, :history, :datamodel, :invoke, :other_element, :id, :initial_attribute, :other_attributes
|
|
1876
|
+
attr_accessor :onentry, :onexit, :transition, :initial, :state, :parallel, :final, :history, :datamodel, :invoke, :other_element, :id, :initial_attribute, :other_attributes, :help_text, :state_order
|
|
1791
1877
|
# Instantiate a new StateProps object.
|
|
1792
1878
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1793
1879
|
def initialize(**kwargs)
|
|
@@ -1805,6 +1891,8 @@ module Scjson
|
|
|
1805
1891
|
@id = kwargs.fetch(:id, nil)
|
|
1806
1892
|
@initial_attribute = kwargs.fetch(:initial_attribute, [])
|
|
1807
1893
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1894
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1895
|
+
@state_order = kwargs.fetch(:state_order, nil)
|
|
1808
1896
|
end
|
|
1809
1897
|
|
|
1810
1898
|
# Build an instance from a Hash representation.
|
|
@@ -1829,6 +1917,8 @@ module Scjson
|
|
|
1829
1917
|
kwargs[:id] = normalized.fetch('id', nil)
|
|
1830
1918
|
kwargs[:initial_attribute] = Array(normalized.fetch('initial_attribute', []))
|
|
1831
1919
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1920
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
1921
|
+
kwargs[:state_order] = normalized['state_order']
|
|
1832
1922
|
new(**kwargs)
|
|
1833
1923
|
end
|
|
1834
1924
|
|
|
@@ -1857,8 +1947,9 @@ module Scjson
|
|
|
1857
1947
|
'other_element' => @other_element,
|
|
1858
1948
|
'id' => @id,
|
|
1859
1949
|
'initial_attribute' => @initial_attribute,
|
|
1860
|
-
'other_attributes' => @other_attributes
|
|
1861
|
-
|
|
1950
|
+
'other_attributes' => @other_attributes,
|
|
1951
|
+
'help_text' => @help_text
|
|
1952
|
+
}.tap { |result| result['state_order'] = @state_order unless @state_order.nil? }
|
|
1862
1953
|
end
|
|
1863
1954
|
|
|
1864
1955
|
# Serialize the object to JSON.
|
|
@@ -1874,7 +1965,7 @@ module Scjson
|
|
|
1874
1965
|
|
|
1875
1966
|
# Structured type for scjson elements.
|
|
1876
1967
|
class TransitionProps
|
|
1877
|
-
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :event, :cond, :target, :type_value, :other_attributes
|
|
1968
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :event, :cond, :target, :type_value, :other_attributes, :help_text, :execution_order
|
|
1878
1969
|
# Instantiate a new TransitionProps object.
|
|
1879
1970
|
# @param kwargs [Hash] Optional keyword overrides.
|
|
1880
1971
|
def initialize(**kwargs)
|
|
@@ -1892,6 +1983,8 @@ module Scjson
|
|
|
1892
1983
|
@target = kwargs.fetch(:target, [])
|
|
1893
1984
|
@type_value = kwargs.fetch(:type_value, nil)
|
|
1894
1985
|
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1986
|
+
@help_text = kwargs.fetch(:help_text, [])
|
|
1987
|
+
@execution_order = kwargs.fetch(:execution_order, nil)
|
|
1895
1988
|
end
|
|
1896
1989
|
|
|
1897
1990
|
# Build an instance from a Hash representation.
|
|
@@ -1916,6 +2009,8 @@ module Scjson
|
|
|
1916
2009
|
kwargs[:target] = Array(normalized.fetch('target', []))
|
|
1917
2010
|
kwargs[:type_value] = normalized.key?('type_value') ? TransitionTypeDatatypeProps.coerce(normalized['type_value'], allow_nil: true) : nil
|
|
1918
2011
|
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
2012
|
+
kwargs[:help_text] = Array(normalized.fetch('help_text', []))
|
|
2013
|
+
kwargs[:execution_order] = normalized['execution_order']
|
|
1919
2014
|
new(**kwargs)
|
|
1920
2015
|
end
|
|
1921
2016
|
|
|
@@ -1944,8 +2039,9 @@ module Scjson
|
|
|
1944
2039
|
'cond' => @cond,
|
|
1945
2040
|
'target' => @target,
|
|
1946
2041
|
'type_value' => @type_value,
|
|
1947
|
-
'other_attributes' => @other_attributes
|
|
1948
|
-
|
|
2042
|
+
'other_attributes' => @other_attributes,
|
|
2043
|
+
'help_text' => @help_text
|
|
2044
|
+
}.tap { |result| result['execution_order'] = @execution_order unless @execution_order.nil? }
|
|
1949
2045
|
end
|
|
1950
2046
|
|
|
1951
2047
|
# Serialize the object to JSON.
|
|
@@ -1959,6 +2055,66 @@ module Scjson
|
|
|
1959
2055
|
# Collection alias for TransitionProps values.
|
|
1960
2056
|
TransitionArray = ::Array
|
|
1961
2057
|
|
|
2058
|
+
# Structured type for scjson elements.
|
|
2059
|
+
class XmlPayloadElementProps
|
|
2060
|
+
attr_accessor :qname, :text, :tail, :children, :attributes
|
|
2061
|
+
# Instantiate a new XmlPayloadElementProps object.
|
|
2062
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
2063
|
+
def initialize(**kwargs)
|
|
2064
|
+
@qname = kwargs.fetch(:qname, '')
|
|
2065
|
+
@text = kwargs.fetch(:text, nil)
|
|
2066
|
+
@tail = kwargs.fetch(:tail, nil)
|
|
2067
|
+
@children = kwargs.fetch(:children, [])
|
|
2068
|
+
@attributes = kwargs.fetch(:attributes, {})
|
|
2069
|
+
end
|
|
2070
|
+
|
|
2071
|
+
# Build an instance from a Hash representation.
|
|
2072
|
+
# @param data [Hash] Canonical hash representation.
|
|
2073
|
+
# @return [XmlPayloadElementProps]
|
|
2074
|
+
def self.from_hash(data)
|
|
2075
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
2076
|
+
|
|
2077
|
+
normalized = data.transform_keys(&:to_s)
|
|
2078
|
+
kwargs = {}
|
|
2079
|
+
kwargs[:qname] = normalized.fetch('qname', '')
|
|
2080
|
+
kwargs[:text] = normalized.fetch('text', nil)
|
|
2081
|
+
kwargs[:tail] = normalized.fetch('tail', nil)
|
|
2082
|
+
kwargs[:children] = Array(normalized.fetch('children', [])).map { |item| XmlPayloadElementProps.from_hash(item) }
|
|
2083
|
+
kwargs[:attributes] = normalized.fetch('attributes', {})
|
|
2084
|
+
new(**kwargs)
|
|
2085
|
+
end
|
|
2086
|
+
|
|
2087
|
+
# Deserialize an instance from a JSON payload.
|
|
2088
|
+
# @param json [String] JSON document to decode.
|
|
2089
|
+
# @return [XmlPayloadElementProps]
|
|
2090
|
+
def self.from_json(json)
|
|
2091
|
+
parsed = JSON.parse(json)
|
|
2092
|
+
from_hash(parsed)
|
|
2093
|
+
end
|
|
2094
|
+
|
|
2095
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
2096
|
+
# @return [Hash]
|
|
2097
|
+
def to_hash
|
|
2098
|
+
{
|
|
2099
|
+
'qname' => @qname,
|
|
2100
|
+
'text' => @text,
|
|
2101
|
+
'tail' => @tail,
|
|
2102
|
+
'children' => (@children || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
2103
|
+
'attributes' => @attributes
|
|
2104
|
+
}
|
|
2105
|
+
end
|
|
2106
|
+
|
|
2107
|
+
# Serialize the object to JSON.
|
|
2108
|
+
# @param opts [Array] JSON generation options.
|
|
2109
|
+
# @return [String]
|
|
2110
|
+
def to_json(*opts)
|
|
2111
|
+
JSON.generate(to_hash, *opts)
|
|
2112
|
+
end
|
|
2113
|
+
end
|
|
2114
|
+
|
|
2115
|
+
# Collection alias for XmlPayloadElementProps values.
|
|
2116
|
+
XmlPayloadElementArray = ::Array
|
|
2117
|
+
|
|
1962
2118
|
end
|
|
1963
2119
|
end
|
|
1964
2120
|
|