scjson 0.3.3 → 0.3.5
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/LEGAL.md +5 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/lib/scjson/cli.rb +86 -2
- data/lib/scjson/engine/context.rb +1597 -0
- data/lib/scjson/engine.rb +187 -0
- data/lib/scjson/types.rb +1964 -0
- data/lib/scjson/version.rb +1 -1
- data/lib/scjson.rb +76 -16
- metadata +19 -6
data/lib/scjson/types.rb
ADDED
|
@@ -0,0 +1,1964 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Agent Name: ruby-props
|
|
4
|
+
#
|
|
5
|
+
# Part of the scjson project.
|
|
6
|
+
# Developed by Softoboros Technology Inc.
|
|
7
|
+
# Licensed under the BSD 1-Clause License.
|
|
8
|
+
|
|
9
|
+
require 'json'
|
|
10
|
+
|
|
11
|
+
# Canonical Ruby representations of the scjson schema.
|
|
12
|
+
module Scjson
|
|
13
|
+
module Types
|
|
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
|
+
module AssignTypeDatatypeProps
|
|
16
|
+
REPLACECHILDREN = 'replacechildren'.freeze
|
|
17
|
+
FIRSTCHILD = 'firstchild'.freeze
|
|
18
|
+
LASTCHILD = 'lastchild'.freeze
|
|
19
|
+
PREVIOUSSIBLING = 'previoussibling'.freeze
|
|
20
|
+
NEXTSIBLING = 'nextsibling'.freeze
|
|
21
|
+
REPLACE = 'replace'.freeze
|
|
22
|
+
DELETE = 'delete'.freeze
|
|
23
|
+
ADDATTRIBUTE = 'addattribute'.freeze
|
|
24
|
+
DEFAULT = REPLACECHILDREN
|
|
25
|
+
VALUES = [REPLACECHILDREN, FIRSTCHILD, LASTCHILD, PREVIOUSSIBLING, NEXTSIBLING, REPLACE, DELETE, ADDATTRIBUTE].freeze
|
|
26
|
+
|
|
27
|
+
module_function
|
|
28
|
+
|
|
29
|
+
# @return [Array<String>] All legal enumeration values.
|
|
30
|
+
def values
|
|
31
|
+
VALUES
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @return [String] Schema-defined default enumeration value.
|
|
35
|
+
def default
|
|
36
|
+
DEFAULT
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
40
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
41
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
42
|
+
# @return [String, nil]
|
|
43
|
+
def coerce(value, allow_nil: false)
|
|
44
|
+
return nil if allow_nil && value.nil?
|
|
45
|
+
return DEFAULT if value.nil?
|
|
46
|
+
|
|
47
|
+
candidate = value.to_s
|
|
48
|
+
return candidate if VALUES.include?(candidate)
|
|
49
|
+
|
|
50
|
+
raise ArgumentError, "Unsupported value '#{value}' for AssignTypeDatatypeProps"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# The binding type in use for the SCXML document.
|
|
55
|
+
module BindingDatatypeProps
|
|
56
|
+
EARLY = 'early'.freeze
|
|
57
|
+
LATE = 'late'.freeze
|
|
58
|
+
DEFAULT = EARLY
|
|
59
|
+
VALUES = [EARLY, LATE].freeze
|
|
60
|
+
|
|
61
|
+
module_function
|
|
62
|
+
|
|
63
|
+
# @return [Array<String>] All legal enumeration values.
|
|
64
|
+
def values
|
|
65
|
+
VALUES
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [String] Schema-defined default enumeration value.
|
|
69
|
+
def default
|
|
70
|
+
DEFAULT
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
74
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
75
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
76
|
+
# @return [String, nil]
|
|
77
|
+
def coerce(value, allow_nil: false)
|
|
78
|
+
return nil if allow_nil && value.nil?
|
|
79
|
+
return DEFAULT if value.nil?
|
|
80
|
+
|
|
81
|
+
candidate = value.to_s
|
|
82
|
+
return candidate if VALUES.include?(candidate)
|
|
83
|
+
|
|
84
|
+
raise ArgumentError, "Unsupported value '#{value}' for BindingDatatypeProps"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Boolean: true or false only
|
|
89
|
+
module BooleanDatatypeProps
|
|
90
|
+
TRUE = 'true'.freeze
|
|
91
|
+
FALSE = 'false'.freeze
|
|
92
|
+
DEFAULT = TRUE
|
|
93
|
+
VALUES = [TRUE, FALSE].freeze
|
|
94
|
+
|
|
95
|
+
module_function
|
|
96
|
+
|
|
97
|
+
# @return [Array<String>] All legal enumeration values.
|
|
98
|
+
def values
|
|
99
|
+
VALUES
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# @return [String] Schema-defined default enumeration value.
|
|
103
|
+
def default
|
|
104
|
+
DEFAULT
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
108
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
109
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
110
|
+
# @return [String, nil]
|
|
111
|
+
def coerce(value, allow_nil: false)
|
|
112
|
+
return nil if allow_nil && value.nil?
|
|
113
|
+
return DEFAULT if value.nil?
|
|
114
|
+
|
|
115
|
+
candidate = value.to_s
|
|
116
|
+
return candidate if VALUES.include?(candidate)
|
|
117
|
+
|
|
118
|
+
raise ArgumentError, "Unsupported value '#{value}' for BooleanDatatypeProps"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Describes the processor execution mode for this document, being either "lax" or "strict".
|
|
123
|
+
module ExmodeDatatypeProps
|
|
124
|
+
LAX = 'lax'.freeze
|
|
125
|
+
STRICT = 'strict'.freeze
|
|
126
|
+
DEFAULT = LAX
|
|
127
|
+
VALUES = [LAX, STRICT].freeze
|
|
128
|
+
|
|
129
|
+
module_function
|
|
130
|
+
|
|
131
|
+
# @return [Array<String>] All legal enumeration values.
|
|
132
|
+
def values
|
|
133
|
+
VALUES
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# @return [String] Schema-defined default enumeration value.
|
|
137
|
+
def default
|
|
138
|
+
DEFAULT
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
142
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
143
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
144
|
+
# @return [String, nil]
|
|
145
|
+
def coerce(value, allow_nil: false)
|
|
146
|
+
return nil if allow_nil && value.nil?
|
|
147
|
+
return DEFAULT if value.nil?
|
|
148
|
+
|
|
149
|
+
candidate = value.to_s
|
|
150
|
+
return candidate if VALUES.include?(candidate)
|
|
151
|
+
|
|
152
|
+
raise ArgumentError, "Unsupported value '#{value}' for ExmodeDatatypeProps"
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# type of `<history>` state: `shallow` or `deep`.
|
|
157
|
+
module HistoryTypeDatatypeProps
|
|
158
|
+
SHALLOW = 'shallow'.freeze
|
|
159
|
+
DEEP = 'deep'.freeze
|
|
160
|
+
DEFAULT = SHALLOW
|
|
161
|
+
VALUES = [SHALLOW, DEEP].freeze
|
|
162
|
+
|
|
163
|
+
module_function
|
|
164
|
+
|
|
165
|
+
# @return [Array<String>] All legal enumeration values.
|
|
166
|
+
def values
|
|
167
|
+
VALUES
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# @return [String] Schema-defined default enumeration value.
|
|
171
|
+
def default
|
|
172
|
+
DEFAULT
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
176
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
177
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
178
|
+
# @return [String, nil]
|
|
179
|
+
def coerce(value, allow_nil: false)
|
|
180
|
+
return nil if allow_nil && value.nil?
|
|
181
|
+
return DEFAULT if value.nil?
|
|
182
|
+
|
|
183
|
+
candidate = value.to_s
|
|
184
|
+
return candidate if VALUES.include?(candidate)
|
|
185
|
+
|
|
186
|
+
raise ArgumentError, "Unsupported value '#{value}' for HistoryTypeDatatypeProps"
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# The type of the transition i.e. internal or external.
|
|
191
|
+
module TransitionTypeDatatypeProps
|
|
192
|
+
INTERNAL = 'internal'.freeze
|
|
193
|
+
EXTERNAL = 'external'.freeze
|
|
194
|
+
DEFAULT = INTERNAL
|
|
195
|
+
VALUES = [INTERNAL, EXTERNAL].freeze
|
|
196
|
+
|
|
197
|
+
module_function
|
|
198
|
+
|
|
199
|
+
# @return [Array<String>] All legal enumeration values.
|
|
200
|
+
def values
|
|
201
|
+
VALUES
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# @return [String] Schema-defined default enumeration value.
|
|
205
|
+
def default
|
|
206
|
+
DEFAULT
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Coerce arbitrary input into a valid enumeration value.
|
|
210
|
+
# @param value [Object, nil] Raw value to coerce.
|
|
211
|
+
# @param allow_nil [Boolean] When true, allow nil to pass-through.
|
|
212
|
+
# @return [String, nil]
|
|
213
|
+
def coerce(value, allow_nil: false)
|
|
214
|
+
return nil if allow_nil && value.nil?
|
|
215
|
+
return DEFAULT if value.nil?
|
|
216
|
+
|
|
217
|
+
candidate = value.to_s
|
|
218
|
+
return candidate if VALUES.include?(candidate)
|
|
219
|
+
|
|
220
|
+
raise ArgumentError, "Unsupported value '#{value}' for TransitionTypeDatatypeProps"
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# update a datamodel location with an expression or value.
|
|
226
|
+
class AssignProps
|
|
227
|
+
attr_accessor :location, :expr, :type_value, :attr, :other_attributes, :content
|
|
228
|
+
# Instantiate a new AssignProps object.
|
|
229
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
230
|
+
def initialize(**kwargs)
|
|
231
|
+
@location = kwargs.fetch(:location, '')
|
|
232
|
+
@expr = kwargs.fetch(:expr, nil)
|
|
233
|
+
@type_value = kwargs.fetch(:type_value, AssignTypeDatatypeProps::REPLACECHILDREN)
|
|
234
|
+
@attr = kwargs.fetch(:attr, nil)
|
|
235
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
236
|
+
@content = kwargs.fetch(:content, [])
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Build an instance from a Hash representation.
|
|
240
|
+
# @param data [Hash] Canonical hash representation.
|
|
241
|
+
# @return [AssignProps]
|
|
242
|
+
def self.from_hash(data)
|
|
243
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
244
|
+
|
|
245
|
+
normalized = data.transform_keys(&:to_s)
|
|
246
|
+
kwargs = {}
|
|
247
|
+
kwargs[:location] = normalized.fetch('location', '')
|
|
248
|
+
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
249
|
+
kwargs[:type_value] = AssignTypeDatatypeProps.coerce(normalized.fetch('type_value', AssignTypeDatatypeProps::REPLACECHILDREN))
|
|
250
|
+
kwargs[:attr] = normalized.fetch('attr', nil)
|
|
251
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
252
|
+
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
253
|
+
new(**kwargs)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Deserialize an instance from a JSON payload.
|
|
257
|
+
# @param json [String] JSON document to decode.
|
|
258
|
+
# @return [AssignProps]
|
|
259
|
+
def self.from_json(json)
|
|
260
|
+
parsed = JSON.parse(json)
|
|
261
|
+
from_hash(parsed)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
265
|
+
# @return [Hash]
|
|
266
|
+
def to_hash
|
|
267
|
+
{
|
|
268
|
+
'location' => @location,
|
|
269
|
+
'expr' => @expr,
|
|
270
|
+
'type_value' => @type_value,
|
|
271
|
+
'attr' => @attr,
|
|
272
|
+
'other_attributes' => @other_attributes,
|
|
273
|
+
'content' => @content
|
|
274
|
+
}
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Serialize the object to JSON.
|
|
278
|
+
# @param opts [Array] JSON generation options.
|
|
279
|
+
# @return [String]
|
|
280
|
+
def to_json(*opts)
|
|
281
|
+
JSON.generate(to_hash, *opts)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Collection alias for AssignProps values.
|
|
286
|
+
AssignArray = ::Array
|
|
287
|
+
|
|
288
|
+
# cancel a pending `<send>` operation.
|
|
289
|
+
class CancelProps
|
|
290
|
+
attr_accessor :other_element, :sendid, :sendidexpr, :other_attributes
|
|
291
|
+
# Instantiate a new CancelProps object.
|
|
292
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
293
|
+
def initialize(**kwargs)
|
|
294
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
295
|
+
@sendid = kwargs.fetch(:sendid, nil)
|
|
296
|
+
@sendidexpr = kwargs.fetch(:sendidexpr, nil)
|
|
297
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Build an instance from a Hash representation.
|
|
301
|
+
# @param data [Hash] Canonical hash representation.
|
|
302
|
+
# @return [CancelProps]
|
|
303
|
+
def self.from_hash(data)
|
|
304
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
305
|
+
|
|
306
|
+
normalized = data.transform_keys(&:to_s)
|
|
307
|
+
kwargs = {}
|
|
308
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
309
|
+
kwargs[:sendid] = normalized.fetch('sendid', nil)
|
|
310
|
+
kwargs[:sendidexpr] = normalized.fetch('sendidexpr', nil)
|
|
311
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
312
|
+
new(**kwargs)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Deserialize an instance from a JSON payload.
|
|
316
|
+
# @param json [String] JSON document to decode.
|
|
317
|
+
# @return [CancelProps]
|
|
318
|
+
def self.from_json(json)
|
|
319
|
+
parsed = JSON.parse(json)
|
|
320
|
+
from_hash(parsed)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
324
|
+
# @return [Hash]
|
|
325
|
+
def to_hash
|
|
326
|
+
{
|
|
327
|
+
'other_element' => @other_element,
|
|
328
|
+
'sendid' => @sendid,
|
|
329
|
+
'sendidexpr' => @sendidexpr,
|
|
330
|
+
'other_attributes' => @other_attributes
|
|
331
|
+
}
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Serialize the object to JSON.
|
|
335
|
+
# @param opts [Array] JSON generation options.
|
|
336
|
+
# @return [String]
|
|
337
|
+
def to_json(*opts)
|
|
338
|
+
JSON.generate(to_hash, *opts)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Collection alias for CancelProps values.
|
|
343
|
+
CancelArray = ::Array
|
|
344
|
+
|
|
345
|
+
# Structured type for scjson elements.
|
|
346
|
+
class ContentProps
|
|
347
|
+
attr_accessor :content, :expr, :other_attributes
|
|
348
|
+
# Instantiate a new ContentProps object.
|
|
349
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
350
|
+
def initialize(**kwargs)
|
|
351
|
+
@content = kwargs.fetch(:content, nil)
|
|
352
|
+
@expr = kwargs.fetch(:expr, nil)
|
|
353
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
# Build an instance from a Hash representation.
|
|
357
|
+
# @param data [Hash] Canonical hash representation.
|
|
358
|
+
# @return [ContentProps]
|
|
359
|
+
def self.from_hash(data)
|
|
360
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
361
|
+
|
|
362
|
+
normalized = data.transform_keys(&:to_s)
|
|
363
|
+
kwargs = {}
|
|
364
|
+
kwargs[:content] = begin
|
|
365
|
+
value = normalized.fetch('content', nil)
|
|
366
|
+
value.nil? ? nil : Array(value).map { |item| ScxmlProps.from_hash(item) }
|
|
367
|
+
end
|
|
368
|
+
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
369
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
370
|
+
new(**kwargs)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Deserialize an instance from a JSON payload.
|
|
374
|
+
# @param json [String] JSON document to decode.
|
|
375
|
+
# @return [ContentProps]
|
|
376
|
+
def self.from_json(json)
|
|
377
|
+
parsed = JSON.parse(json)
|
|
378
|
+
from_hash(parsed)
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
382
|
+
# @return [Hash]
|
|
383
|
+
def to_hash
|
|
384
|
+
{
|
|
385
|
+
'content' => (@content || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
386
|
+
'expr' => @expr,
|
|
387
|
+
'other_attributes' => @other_attributes
|
|
388
|
+
}
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
# Serialize the object to JSON.
|
|
392
|
+
# @param opts [Array] JSON generation options.
|
|
393
|
+
# @return [String]
|
|
394
|
+
def to_json(*opts)
|
|
395
|
+
JSON.generate(to_hash, *opts)
|
|
396
|
+
end
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
# Collection alias for ContentProps values.
|
|
400
|
+
ContentArray = ::Array
|
|
401
|
+
|
|
402
|
+
# represents a single datamodel variable.
|
|
403
|
+
class DataProps
|
|
404
|
+
attr_accessor :id, :src, :expr, :other_attributes, :content
|
|
405
|
+
# Instantiate a new DataProps object.
|
|
406
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
407
|
+
def initialize(**kwargs)
|
|
408
|
+
@id = kwargs.fetch(:id, '')
|
|
409
|
+
@src = kwargs.fetch(:src, nil)
|
|
410
|
+
@expr = kwargs.fetch(:expr, nil)
|
|
411
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
412
|
+
@content = kwargs.fetch(:content, [])
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# Build an instance from a Hash representation.
|
|
416
|
+
# @param data [Hash] Canonical hash representation.
|
|
417
|
+
# @return [DataProps]
|
|
418
|
+
def self.from_hash(data)
|
|
419
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
420
|
+
|
|
421
|
+
normalized = data.transform_keys(&:to_s)
|
|
422
|
+
kwargs = {}
|
|
423
|
+
kwargs[:id] = normalized.fetch('id', '')
|
|
424
|
+
kwargs[:src] = normalized.fetch('src', nil)
|
|
425
|
+
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
426
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
427
|
+
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
428
|
+
new(**kwargs)
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
# Deserialize an instance from a JSON payload.
|
|
432
|
+
# @param json [String] JSON document to decode.
|
|
433
|
+
# @return [DataProps]
|
|
434
|
+
def self.from_json(json)
|
|
435
|
+
parsed = JSON.parse(json)
|
|
436
|
+
from_hash(parsed)
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
440
|
+
# @return [Hash]
|
|
441
|
+
def to_hash
|
|
442
|
+
{
|
|
443
|
+
'id' => @id,
|
|
444
|
+
'src' => @src,
|
|
445
|
+
'expr' => @expr,
|
|
446
|
+
'other_attributes' => @other_attributes,
|
|
447
|
+
'content' => @content
|
|
448
|
+
}
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Serialize the object to JSON.
|
|
452
|
+
# @param opts [Array] JSON generation options.
|
|
453
|
+
# @return [String]
|
|
454
|
+
def to_json(*opts)
|
|
455
|
+
JSON.generate(to_hash, *opts)
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
# Collection alias for DataProps values.
|
|
460
|
+
DataArray = ::Array
|
|
461
|
+
|
|
462
|
+
# container for one or more `<data>` elements.
|
|
463
|
+
class DatamodelProps
|
|
464
|
+
attr_accessor :data, :other_element, :other_attributes
|
|
465
|
+
# Instantiate a new DatamodelProps object.
|
|
466
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
467
|
+
def initialize(**kwargs)
|
|
468
|
+
@data = kwargs.fetch(:data, [])
|
|
469
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
470
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
# Build an instance from a Hash representation.
|
|
474
|
+
# @param data [Hash] Canonical hash representation.
|
|
475
|
+
# @return [DatamodelProps]
|
|
476
|
+
def self.from_hash(data)
|
|
477
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
478
|
+
|
|
479
|
+
normalized = data.transform_keys(&:to_s)
|
|
480
|
+
kwargs = {}
|
|
481
|
+
kwargs[:data] = Array(normalized.fetch('data', [])).map { |item| DataProps.from_hash(item) }
|
|
482
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
483
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
484
|
+
new(**kwargs)
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
# Deserialize an instance from a JSON payload.
|
|
488
|
+
# @param json [String] JSON document to decode.
|
|
489
|
+
# @return [DatamodelProps]
|
|
490
|
+
def self.from_json(json)
|
|
491
|
+
parsed = JSON.parse(json)
|
|
492
|
+
from_hash(parsed)
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
496
|
+
# @return [Hash]
|
|
497
|
+
def to_hash
|
|
498
|
+
{
|
|
499
|
+
'data' => (@data || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
500
|
+
'other_element' => @other_element,
|
|
501
|
+
'other_attributes' => @other_attributes
|
|
502
|
+
}
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
# Serialize the object to JSON.
|
|
506
|
+
# @param opts [Array] JSON generation options.
|
|
507
|
+
# @return [String]
|
|
508
|
+
def to_json(*opts)
|
|
509
|
+
JSON.generate(to_hash, *opts)
|
|
510
|
+
end
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
# Collection alias for DatamodelProps values.
|
|
514
|
+
DatamodelArray = ::Array
|
|
515
|
+
|
|
516
|
+
# Structured type for scjson elements.
|
|
517
|
+
class DonedataProps
|
|
518
|
+
attr_accessor :content, :param, :other_attributes
|
|
519
|
+
# Instantiate a new DonedataProps object.
|
|
520
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
521
|
+
def initialize(**kwargs)
|
|
522
|
+
@content = kwargs.fetch(:content, nil)
|
|
523
|
+
@param = kwargs.fetch(:param, [])
|
|
524
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
# Build an instance from a Hash representation.
|
|
528
|
+
# @param data [Hash] Canonical hash representation.
|
|
529
|
+
# @return [DonedataProps]
|
|
530
|
+
def self.from_hash(data)
|
|
531
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
532
|
+
|
|
533
|
+
normalized = data.transform_keys(&:to_s)
|
|
534
|
+
kwargs = {}
|
|
535
|
+
kwargs[:content] = normalized.key?('content') && normalized['content'] ? ContentProps.from_hash(normalized['content']) : nil
|
|
536
|
+
kwargs[:param] = Array(normalized.fetch('param', [])).map { |item| ParamProps.from_hash(item) }
|
|
537
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
538
|
+
new(**kwargs)
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
# Deserialize an instance from a JSON payload.
|
|
542
|
+
# @param json [String] JSON document to decode.
|
|
543
|
+
# @return [DonedataProps]
|
|
544
|
+
def self.from_json(json)
|
|
545
|
+
parsed = JSON.parse(json)
|
|
546
|
+
from_hash(parsed)
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
550
|
+
# @return [Hash]
|
|
551
|
+
def to_hash
|
|
552
|
+
{
|
|
553
|
+
'content' => @content&.to_hash,
|
|
554
|
+
'param' => (@param || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
555
|
+
'other_attributes' => @other_attributes
|
|
556
|
+
}
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
# Serialize the object to JSON.
|
|
560
|
+
# @param opts [Array] JSON generation options.
|
|
561
|
+
# @return [String]
|
|
562
|
+
def to_json(*opts)
|
|
563
|
+
JSON.generate(to_hash, *opts)
|
|
564
|
+
end
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
# Collection alias for DonedataProps values.
|
|
568
|
+
DonedataArray = ::Array
|
|
569
|
+
|
|
570
|
+
# fallback branch for `<if>` conditions.
|
|
571
|
+
class ElseProps
|
|
572
|
+
attr_accessor :other_attributes
|
|
573
|
+
# Instantiate a new ElseProps object.
|
|
574
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
575
|
+
def initialize(**kwargs)
|
|
576
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
# Build an instance from a Hash representation.
|
|
580
|
+
# @param data [Hash] Canonical hash representation.
|
|
581
|
+
# @return [ElseProps]
|
|
582
|
+
def self.from_hash(data)
|
|
583
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
584
|
+
|
|
585
|
+
normalized = data.transform_keys(&:to_s)
|
|
586
|
+
kwargs = {}
|
|
587
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
588
|
+
new(**kwargs)
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
# Deserialize an instance from a JSON payload.
|
|
592
|
+
# @param json [String] JSON document to decode.
|
|
593
|
+
# @return [ElseProps]
|
|
594
|
+
def self.from_json(json)
|
|
595
|
+
parsed = JSON.parse(json)
|
|
596
|
+
from_hash(parsed)
|
|
597
|
+
end
|
|
598
|
+
|
|
599
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
600
|
+
# @return [Hash]
|
|
601
|
+
def to_hash
|
|
602
|
+
{
|
|
603
|
+
'other_attributes' => @other_attributes
|
|
604
|
+
}
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
# Serialize the object to JSON.
|
|
608
|
+
# @param opts [Array] JSON generation options.
|
|
609
|
+
# @return [String]
|
|
610
|
+
def to_json(*opts)
|
|
611
|
+
JSON.generate(to_hash, *opts)
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
|
|
615
|
+
# conditional branch following an `<if>`.
|
|
616
|
+
class ElseifProps
|
|
617
|
+
attr_accessor :cond, :other_attributes
|
|
618
|
+
# Instantiate a new ElseifProps object.
|
|
619
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
620
|
+
def initialize(**kwargs)
|
|
621
|
+
@cond = kwargs.fetch(:cond, '')
|
|
622
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
623
|
+
end
|
|
624
|
+
|
|
625
|
+
# Build an instance from a Hash representation.
|
|
626
|
+
# @param data [Hash] Canonical hash representation.
|
|
627
|
+
# @return [ElseifProps]
|
|
628
|
+
def self.from_hash(data)
|
|
629
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
630
|
+
|
|
631
|
+
normalized = data.transform_keys(&:to_s)
|
|
632
|
+
kwargs = {}
|
|
633
|
+
kwargs[:cond] = normalized.fetch('cond', '')
|
|
634
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
635
|
+
new(**kwargs)
|
|
636
|
+
end
|
|
637
|
+
|
|
638
|
+
# Deserialize an instance from a JSON payload.
|
|
639
|
+
# @param json [String] JSON document to decode.
|
|
640
|
+
# @return [ElseifProps]
|
|
641
|
+
def self.from_json(json)
|
|
642
|
+
parsed = JSON.parse(json)
|
|
643
|
+
from_hash(parsed)
|
|
644
|
+
end
|
|
645
|
+
|
|
646
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
647
|
+
# @return [Hash]
|
|
648
|
+
def to_hash
|
|
649
|
+
{
|
|
650
|
+
'cond' => @cond,
|
|
651
|
+
'other_attributes' => @other_attributes
|
|
652
|
+
}
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# Serialize the object to JSON.
|
|
656
|
+
# @param opts [Array] JSON generation options.
|
|
657
|
+
# @return [String]
|
|
658
|
+
def to_json(*opts)
|
|
659
|
+
JSON.generate(to_hash, *opts)
|
|
660
|
+
end
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
# Structured type for scjson elements.
|
|
664
|
+
class FinalProps
|
|
665
|
+
attr_accessor :onentry, :onexit, :donedata, :other_element, :id, :other_attributes
|
|
666
|
+
# Instantiate a new FinalProps object.
|
|
667
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
668
|
+
def initialize(**kwargs)
|
|
669
|
+
@onentry = kwargs.fetch(:onentry, [])
|
|
670
|
+
@onexit = kwargs.fetch(:onexit, [])
|
|
671
|
+
@donedata = kwargs.fetch(:donedata, [])
|
|
672
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
673
|
+
@id = kwargs.fetch(:id, nil)
|
|
674
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
# Build an instance from a Hash representation.
|
|
678
|
+
# @param data [Hash] Canonical hash representation.
|
|
679
|
+
# @return [FinalProps]
|
|
680
|
+
def self.from_hash(data)
|
|
681
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
682
|
+
|
|
683
|
+
normalized = data.transform_keys(&:to_s)
|
|
684
|
+
kwargs = {}
|
|
685
|
+
kwargs[:onentry] = Array(normalized.fetch('onentry', [])).map { |item| OnentryProps.from_hash(item) }
|
|
686
|
+
kwargs[:onexit] = Array(normalized.fetch('onexit', [])).map { |item| OnexitProps.from_hash(item) }
|
|
687
|
+
kwargs[:donedata] = Array(normalized.fetch('donedata', [])).map { |item| DonedataProps.from_hash(item) }
|
|
688
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
689
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
690
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
691
|
+
new(**kwargs)
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# Deserialize an instance from a JSON payload.
|
|
695
|
+
# @param json [String] JSON document to decode.
|
|
696
|
+
# @return [FinalProps]
|
|
697
|
+
def self.from_json(json)
|
|
698
|
+
parsed = JSON.parse(json)
|
|
699
|
+
from_hash(parsed)
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
703
|
+
# @return [Hash]
|
|
704
|
+
def to_hash
|
|
705
|
+
{
|
|
706
|
+
'onentry' => (@onentry || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
707
|
+
'onexit' => (@onexit || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
708
|
+
'donedata' => (@donedata || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
709
|
+
'other_element' => @other_element,
|
|
710
|
+
'id' => @id,
|
|
711
|
+
'other_attributes' => @other_attributes
|
|
712
|
+
}
|
|
713
|
+
end
|
|
714
|
+
|
|
715
|
+
# Serialize the object to JSON.
|
|
716
|
+
# @param opts [Array] JSON generation options.
|
|
717
|
+
# @return [String]
|
|
718
|
+
def to_json(*opts)
|
|
719
|
+
JSON.generate(to_hash, *opts)
|
|
720
|
+
end
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
# Collection alias for FinalProps values.
|
|
724
|
+
FinalArray = ::Array
|
|
725
|
+
|
|
726
|
+
# Structured type for scjson elements.
|
|
727
|
+
class FinalizeProps
|
|
728
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
729
|
+
# Instantiate a new FinalizeProps object.
|
|
730
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
731
|
+
def initialize(**kwargs)
|
|
732
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
733
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
734
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
735
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
736
|
+
@send = kwargs.fetch(:send, [])
|
|
737
|
+
@script = kwargs.fetch(:script, [])
|
|
738
|
+
@assign = kwargs.fetch(:assign, [])
|
|
739
|
+
@log = kwargs.fetch(:log, [])
|
|
740
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
741
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
742
|
+
end
|
|
743
|
+
|
|
744
|
+
# Build an instance from a Hash representation.
|
|
745
|
+
# @param data [Hash] Canonical hash representation.
|
|
746
|
+
# @return [FinalizeProps]
|
|
747
|
+
def self.from_hash(data)
|
|
748
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
749
|
+
|
|
750
|
+
normalized = data.transform_keys(&:to_s)
|
|
751
|
+
kwargs = {}
|
|
752
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
753
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
754
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
755
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
756
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
757
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
758
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
759
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
760
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
761
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
762
|
+
new(**kwargs)
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
# Deserialize an instance from a JSON payload.
|
|
766
|
+
# @param json [String] JSON document to decode.
|
|
767
|
+
# @return [FinalizeProps]
|
|
768
|
+
def self.from_json(json)
|
|
769
|
+
parsed = JSON.parse(json)
|
|
770
|
+
from_hash(parsed)
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
774
|
+
# @return [Hash]
|
|
775
|
+
def to_hash
|
|
776
|
+
{
|
|
777
|
+
'other_element' => @other_element,
|
|
778
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
779
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
780
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
781
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
782
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
783
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
784
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
785
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
786
|
+
'other_attributes' => @other_attributes
|
|
787
|
+
}
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
# Serialize the object to JSON.
|
|
791
|
+
# @param opts [Array] JSON generation options.
|
|
792
|
+
# @return [String]
|
|
793
|
+
def to_json(*opts)
|
|
794
|
+
JSON.generate(to_hash, *opts)
|
|
795
|
+
end
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
# Collection alias for FinalizeProps values.
|
|
799
|
+
FinalizeArray = ::Array
|
|
800
|
+
|
|
801
|
+
# Structured type for scjson elements.
|
|
802
|
+
class ForeachProps
|
|
803
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :array, :item, :index, :other_attributes
|
|
804
|
+
# Instantiate a new ForeachProps object.
|
|
805
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
806
|
+
def initialize(**kwargs)
|
|
807
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
808
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
809
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
810
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
811
|
+
@send = kwargs.fetch(:send, [])
|
|
812
|
+
@script = kwargs.fetch(:script, [])
|
|
813
|
+
@assign = kwargs.fetch(:assign, [])
|
|
814
|
+
@log = kwargs.fetch(:log, [])
|
|
815
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
816
|
+
@array = kwargs.fetch(:array, '')
|
|
817
|
+
@item = kwargs.fetch(:item, '')
|
|
818
|
+
@index = kwargs.fetch(:index, nil)
|
|
819
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
820
|
+
end
|
|
821
|
+
|
|
822
|
+
# Build an instance from a Hash representation.
|
|
823
|
+
# @param data [Hash] Canonical hash representation.
|
|
824
|
+
# @return [ForeachProps]
|
|
825
|
+
def self.from_hash(data)
|
|
826
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
827
|
+
|
|
828
|
+
normalized = data.transform_keys(&:to_s)
|
|
829
|
+
kwargs = {}
|
|
830
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
831
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
832
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
833
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
834
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
835
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
836
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
837
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
838
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
839
|
+
kwargs[:array] = normalized.fetch('array', '')
|
|
840
|
+
kwargs[:item] = normalized.fetch('item', '')
|
|
841
|
+
kwargs[:index] = normalized.fetch('index', nil)
|
|
842
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
843
|
+
new(**kwargs)
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
# Deserialize an instance from a JSON payload.
|
|
847
|
+
# @param json [String] JSON document to decode.
|
|
848
|
+
# @return [ForeachProps]
|
|
849
|
+
def self.from_json(json)
|
|
850
|
+
parsed = JSON.parse(json)
|
|
851
|
+
from_hash(parsed)
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
855
|
+
# @return [Hash]
|
|
856
|
+
def to_hash
|
|
857
|
+
{
|
|
858
|
+
'other_element' => @other_element,
|
|
859
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
860
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
861
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
862
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
863
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
864
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
865
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
866
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
867
|
+
'array' => @array,
|
|
868
|
+
'item' => @item,
|
|
869
|
+
'index' => @index,
|
|
870
|
+
'other_attributes' => @other_attributes
|
|
871
|
+
}
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
# Serialize the object to JSON.
|
|
875
|
+
# @param opts [Array] JSON generation options.
|
|
876
|
+
# @return [String]
|
|
877
|
+
def to_json(*opts)
|
|
878
|
+
JSON.generate(to_hash, *opts)
|
|
879
|
+
end
|
|
880
|
+
end
|
|
881
|
+
|
|
882
|
+
# Collection alias for ForeachProps values.
|
|
883
|
+
ForeachArray = ::Array
|
|
884
|
+
|
|
885
|
+
# Structured type for scjson elements.
|
|
886
|
+
class HistoryProps
|
|
887
|
+
attr_accessor :other_element, :transition, :id, :type_value, :other_attributes
|
|
888
|
+
# Instantiate a new HistoryProps object.
|
|
889
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
890
|
+
def initialize(**kwargs)
|
|
891
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
892
|
+
@transition = kwargs.fetch(:transition, TransitionProps.new)
|
|
893
|
+
@id = kwargs.fetch(:id, nil)
|
|
894
|
+
@type_value = kwargs.fetch(:type_value, nil)
|
|
895
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
# Build an instance from a Hash representation.
|
|
899
|
+
# @param data [Hash] Canonical hash representation.
|
|
900
|
+
# @return [HistoryProps]
|
|
901
|
+
def self.from_hash(data)
|
|
902
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
903
|
+
|
|
904
|
+
normalized = data.transform_keys(&:to_s)
|
|
905
|
+
kwargs = {}
|
|
906
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
907
|
+
kwargs[:transition] = normalized.key?('transition') && normalized['transition'] ? TransitionProps.from_hash(normalized['transition']) : TransitionProps.new
|
|
908
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
909
|
+
kwargs[:type_value] = normalized.key?('type_value') ? HistoryTypeDatatypeProps.coerce(normalized['type_value'], allow_nil: true) : nil
|
|
910
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
911
|
+
new(**kwargs)
|
|
912
|
+
end
|
|
913
|
+
|
|
914
|
+
# Deserialize an instance from a JSON payload.
|
|
915
|
+
# @param json [String] JSON document to decode.
|
|
916
|
+
# @return [HistoryProps]
|
|
917
|
+
def self.from_json(json)
|
|
918
|
+
parsed = JSON.parse(json)
|
|
919
|
+
from_hash(parsed)
|
|
920
|
+
end
|
|
921
|
+
|
|
922
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
923
|
+
# @return [Hash]
|
|
924
|
+
def to_hash
|
|
925
|
+
{
|
|
926
|
+
'other_element' => @other_element,
|
|
927
|
+
'transition' => @transition&.to_hash,
|
|
928
|
+
'id' => @id,
|
|
929
|
+
'type_value' => @type_value,
|
|
930
|
+
'other_attributes' => @other_attributes
|
|
931
|
+
}
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
# Serialize the object to JSON.
|
|
935
|
+
# @param opts [Array] JSON generation options.
|
|
936
|
+
# @return [String]
|
|
937
|
+
def to_json(*opts)
|
|
938
|
+
JSON.generate(to_hash, *opts)
|
|
939
|
+
end
|
|
940
|
+
end
|
|
941
|
+
|
|
942
|
+
# Collection alias for HistoryProps values.
|
|
943
|
+
HistoryArray = ::Array
|
|
944
|
+
|
|
945
|
+
# Structured type for scjson elements.
|
|
946
|
+
class IfProps
|
|
947
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :elseif, :else_value, :cond, :other_attributes
|
|
948
|
+
# Instantiate a new IfProps object.
|
|
949
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
950
|
+
def initialize(**kwargs)
|
|
951
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
952
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
953
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
954
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
955
|
+
@send = kwargs.fetch(:send, [])
|
|
956
|
+
@script = kwargs.fetch(:script, [])
|
|
957
|
+
@assign = kwargs.fetch(:assign, [])
|
|
958
|
+
@log = kwargs.fetch(:log, [])
|
|
959
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
960
|
+
@elseif = kwargs.fetch(:elseif, nil)
|
|
961
|
+
@else_value = kwargs.fetch(:else_value, nil)
|
|
962
|
+
@cond = kwargs.fetch(:cond, '')
|
|
963
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
964
|
+
end
|
|
965
|
+
|
|
966
|
+
# Build an instance from a Hash representation.
|
|
967
|
+
# @param data [Hash] Canonical hash representation.
|
|
968
|
+
# @return [IfProps]
|
|
969
|
+
def self.from_hash(data)
|
|
970
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
971
|
+
|
|
972
|
+
normalized = data.transform_keys(&:to_s)
|
|
973
|
+
kwargs = {}
|
|
974
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
975
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
976
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
977
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
978
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
979
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
980
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
981
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
982
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
983
|
+
kwargs[:elseif] = normalized.key?('elseif') && normalized['elseif'] ? ElseifProps.from_hash(normalized['elseif']) : nil
|
|
984
|
+
kwargs[:else_value] = normalized.key?('else_value') && normalized['else_value'] ? ElseProps.from_hash(normalized['else_value']) : nil
|
|
985
|
+
kwargs[:cond] = normalized.fetch('cond', '')
|
|
986
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
987
|
+
new(**kwargs)
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
# Deserialize an instance from a JSON payload.
|
|
991
|
+
# @param json [String] JSON document to decode.
|
|
992
|
+
# @return [IfProps]
|
|
993
|
+
def self.from_json(json)
|
|
994
|
+
parsed = JSON.parse(json)
|
|
995
|
+
from_hash(parsed)
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
999
|
+
# @return [Hash]
|
|
1000
|
+
def to_hash
|
|
1001
|
+
{
|
|
1002
|
+
'other_element' => @other_element,
|
|
1003
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1004
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1005
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1006
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1007
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1008
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1009
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1010
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1011
|
+
'elseif' => @elseif&.to_hash,
|
|
1012
|
+
'else_value' => @else_value&.to_hash,
|
|
1013
|
+
'cond' => @cond,
|
|
1014
|
+
'other_attributes' => @other_attributes
|
|
1015
|
+
}
|
|
1016
|
+
end
|
|
1017
|
+
|
|
1018
|
+
# Serialize the object to JSON.
|
|
1019
|
+
# @param opts [Array] JSON generation options.
|
|
1020
|
+
# @return [String]
|
|
1021
|
+
def to_json(*opts)
|
|
1022
|
+
JSON.generate(to_hash, *opts)
|
|
1023
|
+
end
|
|
1024
|
+
end
|
|
1025
|
+
|
|
1026
|
+
# Collection alias for IfProps values.
|
|
1027
|
+
IfArray = ::Array
|
|
1028
|
+
|
|
1029
|
+
# Structured type for scjson elements.
|
|
1030
|
+
class InitialProps
|
|
1031
|
+
attr_accessor :other_element, :transition, :other_attributes
|
|
1032
|
+
# Instantiate a new InitialProps object.
|
|
1033
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1034
|
+
def initialize(**kwargs)
|
|
1035
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1036
|
+
@transition = kwargs.fetch(:transition, TransitionProps.new)
|
|
1037
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1038
|
+
end
|
|
1039
|
+
|
|
1040
|
+
# Build an instance from a Hash representation.
|
|
1041
|
+
# @param data [Hash] Canonical hash representation.
|
|
1042
|
+
# @return [InitialProps]
|
|
1043
|
+
def self.from_hash(data)
|
|
1044
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1045
|
+
|
|
1046
|
+
normalized = data.transform_keys(&:to_s)
|
|
1047
|
+
kwargs = {}
|
|
1048
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1049
|
+
kwargs[:transition] = normalized.key?('transition') && normalized['transition'] ? TransitionProps.from_hash(normalized['transition']) : TransitionProps.new
|
|
1050
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1051
|
+
new(**kwargs)
|
|
1052
|
+
end
|
|
1053
|
+
|
|
1054
|
+
# Deserialize an instance from a JSON payload.
|
|
1055
|
+
# @param json [String] JSON document to decode.
|
|
1056
|
+
# @return [InitialProps]
|
|
1057
|
+
def self.from_json(json)
|
|
1058
|
+
parsed = JSON.parse(json)
|
|
1059
|
+
from_hash(parsed)
|
|
1060
|
+
end
|
|
1061
|
+
|
|
1062
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1063
|
+
# @return [Hash]
|
|
1064
|
+
def to_hash
|
|
1065
|
+
{
|
|
1066
|
+
'other_element' => @other_element,
|
|
1067
|
+
'transition' => @transition&.to_hash,
|
|
1068
|
+
'other_attributes' => @other_attributes
|
|
1069
|
+
}
|
|
1070
|
+
end
|
|
1071
|
+
|
|
1072
|
+
# Serialize the object to JSON.
|
|
1073
|
+
# @param opts [Array] JSON generation options.
|
|
1074
|
+
# @return [String]
|
|
1075
|
+
def to_json(*opts)
|
|
1076
|
+
JSON.generate(to_hash, *opts)
|
|
1077
|
+
end
|
|
1078
|
+
end
|
|
1079
|
+
|
|
1080
|
+
# Collection alias for InitialProps values.
|
|
1081
|
+
InitialArray = ::Array
|
|
1082
|
+
|
|
1083
|
+
# Structured type for scjson elements.
|
|
1084
|
+
class InvokeProps
|
|
1085
|
+
attr_accessor :content, :param, :finalize, :other_element, :type_value, :typeexpr, :src, :srcexpr, :id, :idlocation, :namelist, :autoforward, :other_attributes
|
|
1086
|
+
# Instantiate a new InvokeProps object.
|
|
1087
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1088
|
+
def initialize(**kwargs)
|
|
1089
|
+
@content = kwargs.fetch(:content, [])
|
|
1090
|
+
@param = kwargs.fetch(:param, [])
|
|
1091
|
+
@finalize = kwargs.fetch(:finalize, [])
|
|
1092
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1093
|
+
@type_value = kwargs.fetch(:type_value, 'scxml')
|
|
1094
|
+
@typeexpr = kwargs.fetch(:typeexpr, nil)
|
|
1095
|
+
@src = kwargs.fetch(:src, nil)
|
|
1096
|
+
@srcexpr = kwargs.fetch(:srcexpr, nil)
|
|
1097
|
+
@id = kwargs.fetch(:id, nil)
|
|
1098
|
+
@idlocation = kwargs.fetch(:idlocation, nil)
|
|
1099
|
+
@namelist = kwargs.fetch(:namelist, nil)
|
|
1100
|
+
@autoforward = kwargs.fetch(:autoforward, BooleanDatatypeProps::FALSE)
|
|
1101
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1102
|
+
end
|
|
1103
|
+
|
|
1104
|
+
# Build an instance from a Hash representation.
|
|
1105
|
+
# @param data [Hash] Canonical hash representation.
|
|
1106
|
+
# @return [InvokeProps]
|
|
1107
|
+
def self.from_hash(data)
|
|
1108
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1109
|
+
|
|
1110
|
+
normalized = data.transform_keys(&:to_s)
|
|
1111
|
+
kwargs = {}
|
|
1112
|
+
kwargs[:content] = Array(normalized.fetch('content', [])).map { |item| ContentProps.from_hash(item) }
|
|
1113
|
+
kwargs[:param] = Array(normalized.fetch('param', [])).map { |item| ParamProps.from_hash(item) }
|
|
1114
|
+
kwargs[:finalize] = Array(normalized.fetch('finalize', [])).map { |item| FinalizeProps.from_hash(item) }
|
|
1115
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1116
|
+
kwargs[:type_value] = normalized.fetch('type_value', 'scxml')
|
|
1117
|
+
kwargs[:typeexpr] = normalized.fetch('typeexpr', nil)
|
|
1118
|
+
kwargs[:src] = normalized.fetch('src', nil)
|
|
1119
|
+
kwargs[:srcexpr] = normalized.fetch('srcexpr', nil)
|
|
1120
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
1121
|
+
kwargs[:idlocation] = normalized.fetch('idlocation', nil)
|
|
1122
|
+
kwargs[:namelist] = normalized.fetch('namelist', nil)
|
|
1123
|
+
kwargs[:autoforward] = BooleanDatatypeProps.coerce(normalized.fetch('autoforward', BooleanDatatypeProps::FALSE))
|
|
1124
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1125
|
+
new(**kwargs)
|
|
1126
|
+
end
|
|
1127
|
+
|
|
1128
|
+
# Deserialize an instance from a JSON payload.
|
|
1129
|
+
# @param json [String] JSON document to decode.
|
|
1130
|
+
# @return [InvokeProps]
|
|
1131
|
+
def self.from_json(json)
|
|
1132
|
+
parsed = JSON.parse(json)
|
|
1133
|
+
from_hash(parsed)
|
|
1134
|
+
end
|
|
1135
|
+
|
|
1136
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1137
|
+
# @return [Hash]
|
|
1138
|
+
def to_hash
|
|
1139
|
+
{
|
|
1140
|
+
'content' => (@content || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1141
|
+
'param' => (@param || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1142
|
+
'finalize' => (@finalize || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1143
|
+
'other_element' => @other_element,
|
|
1144
|
+
'type_value' => @type_value,
|
|
1145
|
+
'typeexpr' => @typeexpr,
|
|
1146
|
+
'src' => @src,
|
|
1147
|
+
'srcexpr' => @srcexpr,
|
|
1148
|
+
'id' => @id,
|
|
1149
|
+
'idlocation' => @idlocation,
|
|
1150
|
+
'namelist' => @namelist,
|
|
1151
|
+
'autoforward' => @autoforward,
|
|
1152
|
+
'other_attributes' => @other_attributes
|
|
1153
|
+
}
|
|
1154
|
+
end
|
|
1155
|
+
|
|
1156
|
+
# Serialize the object to JSON.
|
|
1157
|
+
# @param opts [Array] JSON generation options.
|
|
1158
|
+
# @return [String]
|
|
1159
|
+
def to_json(*opts)
|
|
1160
|
+
JSON.generate(to_hash, *opts)
|
|
1161
|
+
end
|
|
1162
|
+
end
|
|
1163
|
+
|
|
1164
|
+
# Collection alias for InvokeProps values.
|
|
1165
|
+
InvokeArray = ::Array
|
|
1166
|
+
|
|
1167
|
+
# diagnostic output statement.
|
|
1168
|
+
class LogProps
|
|
1169
|
+
attr_accessor :other_element, :label, :expr, :other_attributes
|
|
1170
|
+
# Instantiate a new LogProps object.
|
|
1171
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1172
|
+
def initialize(**kwargs)
|
|
1173
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1174
|
+
@label = kwargs.fetch(:label, nil)
|
|
1175
|
+
@expr = kwargs.fetch(:expr, nil)
|
|
1176
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1177
|
+
end
|
|
1178
|
+
|
|
1179
|
+
# Build an instance from a Hash representation.
|
|
1180
|
+
# @param data [Hash] Canonical hash representation.
|
|
1181
|
+
# @return [LogProps]
|
|
1182
|
+
def self.from_hash(data)
|
|
1183
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1184
|
+
|
|
1185
|
+
normalized = data.transform_keys(&:to_s)
|
|
1186
|
+
kwargs = {}
|
|
1187
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1188
|
+
kwargs[:label] = normalized.fetch('label', nil)
|
|
1189
|
+
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
1190
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1191
|
+
new(**kwargs)
|
|
1192
|
+
end
|
|
1193
|
+
|
|
1194
|
+
# Deserialize an instance from a JSON payload.
|
|
1195
|
+
# @param json [String] JSON document to decode.
|
|
1196
|
+
# @return [LogProps]
|
|
1197
|
+
def self.from_json(json)
|
|
1198
|
+
parsed = JSON.parse(json)
|
|
1199
|
+
from_hash(parsed)
|
|
1200
|
+
end
|
|
1201
|
+
|
|
1202
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1203
|
+
# @return [Hash]
|
|
1204
|
+
def to_hash
|
|
1205
|
+
{
|
|
1206
|
+
'other_element' => @other_element,
|
|
1207
|
+
'label' => @label,
|
|
1208
|
+
'expr' => @expr,
|
|
1209
|
+
'other_attributes' => @other_attributes
|
|
1210
|
+
}
|
|
1211
|
+
end
|
|
1212
|
+
|
|
1213
|
+
# Serialize the object to JSON.
|
|
1214
|
+
# @param opts [Array] JSON generation options.
|
|
1215
|
+
# @return [String]
|
|
1216
|
+
def to_json(*opts)
|
|
1217
|
+
JSON.generate(to_hash, *opts)
|
|
1218
|
+
end
|
|
1219
|
+
end
|
|
1220
|
+
|
|
1221
|
+
# Collection alias for LogProps values.
|
|
1222
|
+
LogArray = ::Array
|
|
1223
|
+
|
|
1224
|
+
# Structured type for scjson elements.
|
|
1225
|
+
class OnentryProps
|
|
1226
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
1227
|
+
# Instantiate a new OnentryProps object.
|
|
1228
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1229
|
+
def initialize(**kwargs)
|
|
1230
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1231
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
1232
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
1233
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
1234
|
+
@send = kwargs.fetch(:send, [])
|
|
1235
|
+
@script = kwargs.fetch(:script, [])
|
|
1236
|
+
@assign = kwargs.fetch(:assign, [])
|
|
1237
|
+
@log = kwargs.fetch(:log, [])
|
|
1238
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
1239
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1240
|
+
end
|
|
1241
|
+
|
|
1242
|
+
# Build an instance from a Hash representation.
|
|
1243
|
+
# @param data [Hash] Canonical hash representation.
|
|
1244
|
+
# @return [OnentryProps]
|
|
1245
|
+
def self.from_hash(data)
|
|
1246
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1247
|
+
|
|
1248
|
+
normalized = data.transform_keys(&:to_s)
|
|
1249
|
+
kwargs = {}
|
|
1250
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1251
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
1252
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
1253
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
1254
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
1255
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
1256
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
1257
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
1258
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
1259
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1260
|
+
new(**kwargs)
|
|
1261
|
+
end
|
|
1262
|
+
|
|
1263
|
+
# Deserialize an instance from a JSON payload.
|
|
1264
|
+
# @param json [String] JSON document to decode.
|
|
1265
|
+
# @return [OnentryProps]
|
|
1266
|
+
def self.from_json(json)
|
|
1267
|
+
parsed = JSON.parse(json)
|
|
1268
|
+
from_hash(parsed)
|
|
1269
|
+
end
|
|
1270
|
+
|
|
1271
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1272
|
+
# @return [Hash]
|
|
1273
|
+
def to_hash
|
|
1274
|
+
{
|
|
1275
|
+
'other_element' => @other_element,
|
|
1276
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1277
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1278
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1279
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1280
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1281
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1282
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1283
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1284
|
+
'other_attributes' => @other_attributes
|
|
1285
|
+
}
|
|
1286
|
+
end
|
|
1287
|
+
|
|
1288
|
+
# Serialize the object to JSON.
|
|
1289
|
+
# @param opts [Array] JSON generation options.
|
|
1290
|
+
# @return [String]
|
|
1291
|
+
def to_json(*opts)
|
|
1292
|
+
JSON.generate(to_hash, *opts)
|
|
1293
|
+
end
|
|
1294
|
+
end
|
|
1295
|
+
|
|
1296
|
+
# Collection alias for OnentryProps values.
|
|
1297
|
+
OnentryArray = ::Array
|
|
1298
|
+
|
|
1299
|
+
# Structured type for scjson elements.
|
|
1300
|
+
class OnexitProps
|
|
1301
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :other_attributes
|
|
1302
|
+
# Instantiate a new OnexitProps object.
|
|
1303
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1304
|
+
def initialize(**kwargs)
|
|
1305
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1306
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
1307
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
1308
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
1309
|
+
@send = kwargs.fetch(:send, [])
|
|
1310
|
+
@script = kwargs.fetch(:script, [])
|
|
1311
|
+
@assign = kwargs.fetch(:assign, [])
|
|
1312
|
+
@log = kwargs.fetch(:log, [])
|
|
1313
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
1314
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1315
|
+
end
|
|
1316
|
+
|
|
1317
|
+
# Build an instance from a Hash representation.
|
|
1318
|
+
# @param data [Hash] Canonical hash representation.
|
|
1319
|
+
# @return [OnexitProps]
|
|
1320
|
+
def self.from_hash(data)
|
|
1321
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1322
|
+
|
|
1323
|
+
normalized = data.transform_keys(&:to_s)
|
|
1324
|
+
kwargs = {}
|
|
1325
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1326
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
1327
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
1328
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
1329
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
1330
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
1331
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
1332
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
1333
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
1334
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1335
|
+
new(**kwargs)
|
|
1336
|
+
end
|
|
1337
|
+
|
|
1338
|
+
# Deserialize an instance from a JSON payload.
|
|
1339
|
+
# @param json [String] JSON document to decode.
|
|
1340
|
+
# @return [OnexitProps]
|
|
1341
|
+
def self.from_json(json)
|
|
1342
|
+
parsed = JSON.parse(json)
|
|
1343
|
+
from_hash(parsed)
|
|
1344
|
+
end
|
|
1345
|
+
|
|
1346
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1347
|
+
# @return [Hash]
|
|
1348
|
+
def to_hash
|
|
1349
|
+
{
|
|
1350
|
+
'other_element' => @other_element,
|
|
1351
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1352
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1353
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1354
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1355
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1356
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1357
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1358
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1359
|
+
'other_attributes' => @other_attributes
|
|
1360
|
+
}
|
|
1361
|
+
end
|
|
1362
|
+
|
|
1363
|
+
# Serialize the object to JSON.
|
|
1364
|
+
# @param opts [Array] JSON generation options.
|
|
1365
|
+
# @return [String]
|
|
1366
|
+
def to_json(*opts)
|
|
1367
|
+
JSON.generate(to_hash, *opts)
|
|
1368
|
+
end
|
|
1369
|
+
end
|
|
1370
|
+
|
|
1371
|
+
# Collection alias for OnexitProps values.
|
|
1372
|
+
OnexitArray = ::Array
|
|
1373
|
+
|
|
1374
|
+
# Structured type for scjson elements.
|
|
1375
|
+
class ParallelProps
|
|
1376
|
+
attr_accessor :onentry, :onexit, :transition, :state, :parallel, :history, :datamodel, :invoke, :other_element, :id, :other_attributes
|
|
1377
|
+
# Instantiate a new ParallelProps object.
|
|
1378
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1379
|
+
def initialize(**kwargs)
|
|
1380
|
+
@onentry = kwargs.fetch(:onentry, [])
|
|
1381
|
+
@onexit = kwargs.fetch(:onexit, [])
|
|
1382
|
+
@transition = kwargs.fetch(:transition, [])
|
|
1383
|
+
@state = kwargs.fetch(:state, [])
|
|
1384
|
+
@parallel = kwargs.fetch(:parallel, [])
|
|
1385
|
+
@history = kwargs.fetch(:history, [])
|
|
1386
|
+
@datamodel = kwargs.fetch(:datamodel, [])
|
|
1387
|
+
@invoke = kwargs.fetch(:invoke, [])
|
|
1388
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1389
|
+
@id = kwargs.fetch(:id, nil)
|
|
1390
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1391
|
+
end
|
|
1392
|
+
|
|
1393
|
+
# Build an instance from a Hash representation.
|
|
1394
|
+
# @param data [Hash] Canonical hash representation.
|
|
1395
|
+
# @return [ParallelProps]
|
|
1396
|
+
def self.from_hash(data)
|
|
1397
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1398
|
+
|
|
1399
|
+
normalized = data.transform_keys(&:to_s)
|
|
1400
|
+
kwargs = {}
|
|
1401
|
+
kwargs[:onentry] = Array(normalized.fetch('onentry', [])).map { |item| OnentryProps.from_hash(item) }
|
|
1402
|
+
kwargs[:onexit] = Array(normalized.fetch('onexit', [])).map { |item| OnexitProps.from_hash(item) }
|
|
1403
|
+
kwargs[:transition] = Array(normalized.fetch('transition', [])).map { |item| TransitionProps.from_hash(item) }
|
|
1404
|
+
kwargs[:state] = Array(normalized.fetch('state', [])).map { |item| StateProps.from_hash(item) }
|
|
1405
|
+
kwargs[:parallel] = Array(normalized.fetch('parallel', [])).map { |item| ParallelProps.from_hash(item) }
|
|
1406
|
+
kwargs[:history] = Array(normalized.fetch('history', [])).map { |item| HistoryProps.from_hash(item) }
|
|
1407
|
+
kwargs[:datamodel] = Array(normalized.fetch('datamodel', [])).map { |item| DatamodelProps.from_hash(item) }
|
|
1408
|
+
kwargs[:invoke] = Array(normalized.fetch('invoke', [])).map { |item| InvokeProps.from_hash(item) }
|
|
1409
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1410
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
1411
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1412
|
+
new(**kwargs)
|
|
1413
|
+
end
|
|
1414
|
+
|
|
1415
|
+
# Deserialize an instance from a JSON payload.
|
|
1416
|
+
# @param json [String] JSON document to decode.
|
|
1417
|
+
# @return [ParallelProps]
|
|
1418
|
+
def self.from_json(json)
|
|
1419
|
+
parsed = JSON.parse(json)
|
|
1420
|
+
from_hash(parsed)
|
|
1421
|
+
end
|
|
1422
|
+
|
|
1423
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1424
|
+
# @return [Hash]
|
|
1425
|
+
def to_hash
|
|
1426
|
+
{
|
|
1427
|
+
'onentry' => (@onentry || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1428
|
+
'onexit' => (@onexit || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1429
|
+
'transition' => (@transition || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1430
|
+
'state' => (@state || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1431
|
+
'parallel' => (@parallel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1432
|
+
'history' => (@history || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1433
|
+
'datamodel' => (@datamodel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1434
|
+
'invoke' => (@invoke || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1435
|
+
'other_element' => @other_element,
|
|
1436
|
+
'id' => @id,
|
|
1437
|
+
'other_attributes' => @other_attributes
|
|
1438
|
+
}
|
|
1439
|
+
end
|
|
1440
|
+
|
|
1441
|
+
# Serialize the object to JSON.
|
|
1442
|
+
# @param opts [Array] JSON generation options.
|
|
1443
|
+
# @return [String]
|
|
1444
|
+
def to_json(*opts)
|
|
1445
|
+
JSON.generate(to_hash, *opts)
|
|
1446
|
+
end
|
|
1447
|
+
end
|
|
1448
|
+
|
|
1449
|
+
# Collection alias for ParallelProps values.
|
|
1450
|
+
ParallelArray = ::Array
|
|
1451
|
+
|
|
1452
|
+
# parameter passed to `<invoke>` or `<send>`.
|
|
1453
|
+
class ParamProps
|
|
1454
|
+
attr_accessor :other_element, :name, :expr, :location, :other_attributes
|
|
1455
|
+
# Instantiate a new ParamProps object.
|
|
1456
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1457
|
+
def initialize(**kwargs)
|
|
1458
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1459
|
+
@name = kwargs.fetch(:name, '')
|
|
1460
|
+
@expr = kwargs.fetch(:expr, nil)
|
|
1461
|
+
@location = kwargs.fetch(:location, nil)
|
|
1462
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1463
|
+
end
|
|
1464
|
+
|
|
1465
|
+
# Build an instance from a Hash representation.
|
|
1466
|
+
# @param data [Hash] Canonical hash representation.
|
|
1467
|
+
# @return [ParamProps]
|
|
1468
|
+
def self.from_hash(data)
|
|
1469
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1470
|
+
|
|
1471
|
+
normalized = data.transform_keys(&:to_s)
|
|
1472
|
+
kwargs = {}
|
|
1473
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1474
|
+
kwargs[:name] = normalized.fetch('name', '')
|
|
1475
|
+
kwargs[:expr] = normalized.fetch('expr', nil)
|
|
1476
|
+
kwargs[:location] = normalized.fetch('location', nil)
|
|
1477
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1478
|
+
new(**kwargs)
|
|
1479
|
+
end
|
|
1480
|
+
|
|
1481
|
+
# Deserialize an instance from a JSON payload.
|
|
1482
|
+
# @param json [String] JSON document to decode.
|
|
1483
|
+
# @return [ParamProps]
|
|
1484
|
+
def self.from_json(json)
|
|
1485
|
+
parsed = JSON.parse(json)
|
|
1486
|
+
from_hash(parsed)
|
|
1487
|
+
end
|
|
1488
|
+
|
|
1489
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1490
|
+
# @return [Hash]
|
|
1491
|
+
def to_hash
|
|
1492
|
+
{
|
|
1493
|
+
'other_element' => @other_element,
|
|
1494
|
+
'name' => @name,
|
|
1495
|
+
'expr' => @expr,
|
|
1496
|
+
'location' => @location,
|
|
1497
|
+
'other_attributes' => @other_attributes
|
|
1498
|
+
}
|
|
1499
|
+
end
|
|
1500
|
+
|
|
1501
|
+
# Serialize the object to JSON.
|
|
1502
|
+
# @param opts [Array] JSON generation options.
|
|
1503
|
+
# @return [String]
|
|
1504
|
+
def to_json(*opts)
|
|
1505
|
+
JSON.generate(to_hash, *opts)
|
|
1506
|
+
end
|
|
1507
|
+
end
|
|
1508
|
+
|
|
1509
|
+
# Collection alias for ParamProps values.
|
|
1510
|
+
ParamArray = ::Array
|
|
1511
|
+
|
|
1512
|
+
# raise an internal event.
|
|
1513
|
+
class RaiseProps
|
|
1514
|
+
attr_accessor :event, :other_attributes
|
|
1515
|
+
# Instantiate a new RaiseProps object.
|
|
1516
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1517
|
+
def initialize(**kwargs)
|
|
1518
|
+
@event = kwargs.fetch(:event, '')
|
|
1519
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1520
|
+
end
|
|
1521
|
+
|
|
1522
|
+
# Build an instance from a Hash representation.
|
|
1523
|
+
# @param data [Hash] Canonical hash representation.
|
|
1524
|
+
# @return [RaiseProps]
|
|
1525
|
+
def self.from_hash(data)
|
|
1526
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1527
|
+
|
|
1528
|
+
normalized = data.transform_keys(&:to_s)
|
|
1529
|
+
kwargs = {}
|
|
1530
|
+
kwargs[:event] = normalized.fetch('event', '')
|
|
1531
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1532
|
+
new(**kwargs)
|
|
1533
|
+
end
|
|
1534
|
+
|
|
1535
|
+
# Deserialize an instance from a JSON payload.
|
|
1536
|
+
# @param json [String] JSON document to decode.
|
|
1537
|
+
# @return [RaiseProps]
|
|
1538
|
+
def self.from_json(json)
|
|
1539
|
+
parsed = JSON.parse(json)
|
|
1540
|
+
from_hash(parsed)
|
|
1541
|
+
end
|
|
1542
|
+
|
|
1543
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1544
|
+
# @return [Hash]
|
|
1545
|
+
def to_hash
|
|
1546
|
+
{
|
|
1547
|
+
'event' => @event,
|
|
1548
|
+
'other_attributes' => @other_attributes
|
|
1549
|
+
}
|
|
1550
|
+
end
|
|
1551
|
+
|
|
1552
|
+
# Serialize the object to JSON.
|
|
1553
|
+
# @param opts [Array] JSON generation options.
|
|
1554
|
+
# @return [String]
|
|
1555
|
+
def to_json(*opts)
|
|
1556
|
+
JSON.generate(to_hash, *opts)
|
|
1557
|
+
end
|
|
1558
|
+
end
|
|
1559
|
+
|
|
1560
|
+
# Collection alias for RaiseProps values.
|
|
1561
|
+
RaiseArray = ::Array
|
|
1562
|
+
|
|
1563
|
+
# inline executable script.
|
|
1564
|
+
class ScriptProps
|
|
1565
|
+
attr_accessor :src, :other_attributes, :content
|
|
1566
|
+
# Instantiate a new ScriptProps object.
|
|
1567
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1568
|
+
def initialize(**kwargs)
|
|
1569
|
+
@src = kwargs.fetch(:src, nil)
|
|
1570
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1571
|
+
@content = kwargs.fetch(:content, [])
|
|
1572
|
+
end
|
|
1573
|
+
|
|
1574
|
+
# Build an instance from a Hash representation.
|
|
1575
|
+
# @param data [Hash] Canonical hash representation.
|
|
1576
|
+
# @return [ScriptProps]
|
|
1577
|
+
def self.from_hash(data)
|
|
1578
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1579
|
+
|
|
1580
|
+
normalized = data.transform_keys(&:to_s)
|
|
1581
|
+
kwargs = {}
|
|
1582
|
+
kwargs[:src] = normalized.fetch('src', nil)
|
|
1583
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1584
|
+
kwargs[:content] = Array(normalized.fetch('content', []))
|
|
1585
|
+
new(**kwargs)
|
|
1586
|
+
end
|
|
1587
|
+
|
|
1588
|
+
# Deserialize an instance from a JSON payload.
|
|
1589
|
+
# @param json [String] JSON document to decode.
|
|
1590
|
+
# @return [ScriptProps]
|
|
1591
|
+
def self.from_json(json)
|
|
1592
|
+
parsed = JSON.parse(json)
|
|
1593
|
+
from_hash(parsed)
|
|
1594
|
+
end
|
|
1595
|
+
|
|
1596
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1597
|
+
# @return [Hash]
|
|
1598
|
+
def to_hash
|
|
1599
|
+
{
|
|
1600
|
+
'src' => @src,
|
|
1601
|
+
'other_attributes' => @other_attributes,
|
|
1602
|
+
'content' => @content
|
|
1603
|
+
}
|
|
1604
|
+
end
|
|
1605
|
+
|
|
1606
|
+
# Serialize the object to JSON.
|
|
1607
|
+
# @param opts [Array] JSON generation options.
|
|
1608
|
+
# @return [String]
|
|
1609
|
+
def to_json(*opts)
|
|
1610
|
+
JSON.generate(to_hash, *opts)
|
|
1611
|
+
end
|
|
1612
|
+
end
|
|
1613
|
+
|
|
1614
|
+
# Collection alias for ScriptProps values.
|
|
1615
|
+
ScriptArray = ::Array
|
|
1616
|
+
|
|
1617
|
+
# Structured type for scjson elements.
|
|
1618
|
+
class ScxmlProps
|
|
1619
|
+
attr_accessor :state, :parallel, :final, :datamodel, :script, :other_element, :initial, :name, :version, :datamodel_attribute, :binding, :exmode, :other_attributes
|
|
1620
|
+
# Instantiate a new ScxmlProps object.
|
|
1621
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1622
|
+
def initialize(**kwargs)
|
|
1623
|
+
@state = kwargs.fetch(:state, [])
|
|
1624
|
+
@parallel = kwargs.fetch(:parallel, [])
|
|
1625
|
+
@final = kwargs.fetch(:final, [])
|
|
1626
|
+
@datamodel = kwargs.fetch(:datamodel, [])
|
|
1627
|
+
@script = kwargs.fetch(:script, [])
|
|
1628
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1629
|
+
@initial = kwargs.fetch(:initial, [])
|
|
1630
|
+
@name = kwargs.fetch(:name, nil)
|
|
1631
|
+
@version = kwargs.fetch(:version, '1.0')
|
|
1632
|
+
@datamodel_attribute = kwargs.fetch(:datamodel_attribute, 'null')
|
|
1633
|
+
@binding = kwargs.fetch(:binding, nil)
|
|
1634
|
+
@exmode = kwargs.fetch(:exmode, nil)
|
|
1635
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1636
|
+
end
|
|
1637
|
+
|
|
1638
|
+
# Build an instance from a Hash representation.
|
|
1639
|
+
# @param data [Hash] Canonical hash representation.
|
|
1640
|
+
# @return [ScxmlProps]
|
|
1641
|
+
def self.from_hash(data)
|
|
1642
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1643
|
+
|
|
1644
|
+
normalized = data.transform_keys(&:to_s)
|
|
1645
|
+
kwargs = {}
|
|
1646
|
+
kwargs[:state] = Array(normalized.fetch('state', [])).map { |item| StateProps.from_hash(item) }
|
|
1647
|
+
kwargs[:parallel] = Array(normalized.fetch('parallel', [])).map { |item| ParallelProps.from_hash(item) }
|
|
1648
|
+
kwargs[:final] = Array(normalized.fetch('final', [])).map { |item| FinalProps.from_hash(item) }
|
|
1649
|
+
kwargs[:datamodel] = Array(normalized.fetch('datamodel', [])).map { |item| DatamodelProps.from_hash(item) }
|
|
1650
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
1651
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1652
|
+
kwargs[:initial] = Array(normalized.fetch('initial', []))
|
|
1653
|
+
kwargs[:name] = normalized.fetch('name', nil)
|
|
1654
|
+
kwargs[:version] = normalized.fetch('version', nil)
|
|
1655
|
+
kwargs[:datamodel_attribute] = normalized.fetch('datamodel_attribute', 'null')
|
|
1656
|
+
kwargs[:binding] = normalized.key?('binding') ? BindingDatatypeProps.coerce(normalized['binding'], allow_nil: true) : nil
|
|
1657
|
+
kwargs[:exmode] = normalized.key?('exmode') ? ExmodeDatatypeProps.coerce(normalized['exmode'], allow_nil: true) : nil
|
|
1658
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1659
|
+
new(**kwargs)
|
|
1660
|
+
end
|
|
1661
|
+
|
|
1662
|
+
# Deserialize an instance from a JSON payload.
|
|
1663
|
+
# @param json [String] JSON document to decode.
|
|
1664
|
+
# @return [ScxmlProps]
|
|
1665
|
+
def self.from_json(json)
|
|
1666
|
+
parsed = JSON.parse(json)
|
|
1667
|
+
from_hash(parsed)
|
|
1668
|
+
end
|
|
1669
|
+
|
|
1670
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1671
|
+
# @return [Hash]
|
|
1672
|
+
def to_hash
|
|
1673
|
+
{
|
|
1674
|
+
'state' => (@state || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1675
|
+
'parallel' => (@parallel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1676
|
+
'final' => (@final || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1677
|
+
'datamodel' => (@datamodel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1678
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1679
|
+
'other_element' => @other_element,
|
|
1680
|
+
'initial' => @initial,
|
|
1681
|
+
'name' => @name,
|
|
1682
|
+
'version' => @version,
|
|
1683
|
+
'datamodel_attribute' => @datamodel_attribute,
|
|
1684
|
+
'binding' => @binding,
|
|
1685
|
+
'exmode' => @exmode,
|
|
1686
|
+
'other_attributes' => @other_attributes
|
|
1687
|
+
}
|
|
1688
|
+
end
|
|
1689
|
+
|
|
1690
|
+
# Serialize the object to JSON.
|
|
1691
|
+
# @param opts [Array] JSON generation options.
|
|
1692
|
+
# @return [String]
|
|
1693
|
+
def to_json(*opts)
|
|
1694
|
+
JSON.generate(to_hash, *opts)
|
|
1695
|
+
end
|
|
1696
|
+
end
|
|
1697
|
+
|
|
1698
|
+
# Structured type for scjson elements.
|
|
1699
|
+
class SendProps
|
|
1700
|
+
attr_accessor :content, :param, :other_element, :event, :eventexpr, :target, :targetexpr, :type_value, :typeexpr, :id, :idlocation, :delay, :delayexpr, :namelist, :other_attributes
|
|
1701
|
+
# Instantiate a new SendProps object.
|
|
1702
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1703
|
+
def initialize(**kwargs)
|
|
1704
|
+
@content = kwargs.fetch(:content, [])
|
|
1705
|
+
@param = kwargs.fetch(:param, [])
|
|
1706
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1707
|
+
@event = kwargs.fetch(:event, nil)
|
|
1708
|
+
@eventexpr = kwargs.fetch(:eventexpr, nil)
|
|
1709
|
+
@target = kwargs.fetch(:target, nil)
|
|
1710
|
+
@targetexpr = kwargs.fetch(:targetexpr, nil)
|
|
1711
|
+
@type_value = kwargs.fetch(:type_value, 'scxml')
|
|
1712
|
+
@typeexpr = kwargs.fetch(:typeexpr, nil)
|
|
1713
|
+
@id = kwargs.fetch(:id, nil)
|
|
1714
|
+
@idlocation = kwargs.fetch(:idlocation, nil)
|
|
1715
|
+
@delay = kwargs.fetch(:delay, '0s')
|
|
1716
|
+
@delayexpr = kwargs.fetch(:delayexpr, nil)
|
|
1717
|
+
@namelist = kwargs.fetch(:namelist, nil)
|
|
1718
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1719
|
+
end
|
|
1720
|
+
|
|
1721
|
+
# Build an instance from a Hash representation.
|
|
1722
|
+
# @param data [Hash] Canonical hash representation.
|
|
1723
|
+
# @return [SendProps]
|
|
1724
|
+
def self.from_hash(data)
|
|
1725
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1726
|
+
|
|
1727
|
+
normalized = data.transform_keys(&:to_s)
|
|
1728
|
+
kwargs = {}
|
|
1729
|
+
kwargs[:content] = Array(normalized.fetch('content', [])).map { |item| ContentProps.from_hash(item) }
|
|
1730
|
+
kwargs[:param] = Array(normalized.fetch('param', [])).map { |item| ParamProps.from_hash(item) }
|
|
1731
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1732
|
+
kwargs[:event] = normalized.fetch('event', nil)
|
|
1733
|
+
kwargs[:eventexpr] = normalized.fetch('eventexpr', nil)
|
|
1734
|
+
kwargs[:target] = normalized.fetch('target', nil)
|
|
1735
|
+
kwargs[:targetexpr] = normalized.fetch('targetexpr', nil)
|
|
1736
|
+
kwargs[:type_value] = normalized.fetch('type_value', 'scxml')
|
|
1737
|
+
kwargs[:typeexpr] = normalized.fetch('typeexpr', nil)
|
|
1738
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
1739
|
+
kwargs[:idlocation] = normalized.fetch('idlocation', nil)
|
|
1740
|
+
kwargs[:delay] = normalized.fetch('delay', '0s')
|
|
1741
|
+
kwargs[:delayexpr] = normalized.fetch('delayexpr', nil)
|
|
1742
|
+
kwargs[:namelist] = normalized.fetch('namelist', nil)
|
|
1743
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1744
|
+
new(**kwargs)
|
|
1745
|
+
end
|
|
1746
|
+
|
|
1747
|
+
# Deserialize an instance from a JSON payload.
|
|
1748
|
+
# @param json [String] JSON document to decode.
|
|
1749
|
+
# @return [SendProps]
|
|
1750
|
+
def self.from_json(json)
|
|
1751
|
+
parsed = JSON.parse(json)
|
|
1752
|
+
from_hash(parsed)
|
|
1753
|
+
end
|
|
1754
|
+
|
|
1755
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1756
|
+
# @return [Hash]
|
|
1757
|
+
def to_hash
|
|
1758
|
+
{
|
|
1759
|
+
'content' => (@content || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1760
|
+
'param' => (@param || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1761
|
+
'other_element' => @other_element,
|
|
1762
|
+
'event' => @event,
|
|
1763
|
+
'eventexpr' => @eventexpr,
|
|
1764
|
+
'target' => @target,
|
|
1765
|
+
'targetexpr' => @targetexpr,
|
|
1766
|
+
'type_value' => @type_value,
|
|
1767
|
+
'typeexpr' => @typeexpr,
|
|
1768
|
+
'id' => @id,
|
|
1769
|
+
'idlocation' => @idlocation,
|
|
1770
|
+
'delay' => @delay,
|
|
1771
|
+
'delayexpr' => @delayexpr,
|
|
1772
|
+
'namelist' => @namelist,
|
|
1773
|
+
'other_attributes' => @other_attributes
|
|
1774
|
+
}
|
|
1775
|
+
end
|
|
1776
|
+
|
|
1777
|
+
# Serialize the object to JSON.
|
|
1778
|
+
# @param opts [Array] JSON generation options.
|
|
1779
|
+
# @return [String]
|
|
1780
|
+
def to_json(*opts)
|
|
1781
|
+
JSON.generate(to_hash, *opts)
|
|
1782
|
+
end
|
|
1783
|
+
end
|
|
1784
|
+
|
|
1785
|
+
# Collection alias for SendProps values.
|
|
1786
|
+
SendArray = ::Array
|
|
1787
|
+
|
|
1788
|
+
# Structured type for scjson elements.
|
|
1789
|
+
class StateProps
|
|
1790
|
+
attr_accessor :onentry, :onexit, :transition, :initial, :state, :parallel, :final, :history, :datamodel, :invoke, :other_element, :id, :initial_attribute, :other_attributes
|
|
1791
|
+
# Instantiate a new StateProps object.
|
|
1792
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1793
|
+
def initialize(**kwargs)
|
|
1794
|
+
@onentry = kwargs.fetch(:onentry, [])
|
|
1795
|
+
@onexit = kwargs.fetch(:onexit, [])
|
|
1796
|
+
@transition = kwargs.fetch(:transition, [])
|
|
1797
|
+
@initial = kwargs.fetch(:initial, [])
|
|
1798
|
+
@state = kwargs.fetch(:state, [])
|
|
1799
|
+
@parallel = kwargs.fetch(:parallel, [])
|
|
1800
|
+
@final = kwargs.fetch(:final, [])
|
|
1801
|
+
@history = kwargs.fetch(:history, [])
|
|
1802
|
+
@datamodel = kwargs.fetch(:datamodel, [])
|
|
1803
|
+
@invoke = kwargs.fetch(:invoke, [])
|
|
1804
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1805
|
+
@id = kwargs.fetch(:id, nil)
|
|
1806
|
+
@initial_attribute = kwargs.fetch(:initial_attribute, [])
|
|
1807
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1808
|
+
end
|
|
1809
|
+
|
|
1810
|
+
# Build an instance from a Hash representation.
|
|
1811
|
+
# @param data [Hash] Canonical hash representation.
|
|
1812
|
+
# @return [StateProps]
|
|
1813
|
+
def self.from_hash(data)
|
|
1814
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1815
|
+
|
|
1816
|
+
normalized = data.transform_keys(&:to_s)
|
|
1817
|
+
kwargs = {}
|
|
1818
|
+
kwargs[:onentry] = Array(normalized.fetch('onentry', [])).map { |item| OnentryProps.from_hash(item) }
|
|
1819
|
+
kwargs[:onexit] = Array(normalized.fetch('onexit', [])).map { |item| OnexitProps.from_hash(item) }
|
|
1820
|
+
kwargs[:transition] = Array(normalized.fetch('transition', [])).map { |item| TransitionProps.from_hash(item) }
|
|
1821
|
+
kwargs[:initial] = Array(normalized.fetch('initial', [])).map { |item| InitialProps.from_hash(item) }
|
|
1822
|
+
kwargs[:state] = Array(normalized.fetch('state', [])).map { |item| StateProps.from_hash(item) }
|
|
1823
|
+
kwargs[:parallel] = Array(normalized.fetch('parallel', [])).map { |item| ParallelProps.from_hash(item) }
|
|
1824
|
+
kwargs[:final] = Array(normalized.fetch('final', [])).map { |item| FinalProps.from_hash(item) }
|
|
1825
|
+
kwargs[:history] = Array(normalized.fetch('history', [])).map { |item| HistoryProps.from_hash(item) }
|
|
1826
|
+
kwargs[:datamodel] = Array(normalized.fetch('datamodel', [])).map { |item| DatamodelProps.from_hash(item) }
|
|
1827
|
+
kwargs[:invoke] = Array(normalized.fetch('invoke', [])).map { |item| InvokeProps.from_hash(item) }
|
|
1828
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1829
|
+
kwargs[:id] = normalized.fetch('id', nil)
|
|
1830
|
+
kwargs[:initial_attribute] = Array(normalized.fetch('initial_attribute', []))
|
|
1831
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1832
|
+
new(**kwargs)
|
|
1833
|
+
end
|
|
1834
|
+
|
|
1835
|
+
# Deserialize an instance from a JSON payload.
|
|
1836
|
+
# @param json [String] JSON document to decode.
|
|
1837
|
+
# @return [StateProps]
|
|
1838
|
+
def self.from_json(json)
|
|
1839
|
+
parsed = JSON.parse(json)
|
|
1840
|
+
from_hash(parsed)
|
|
1841
|
+
end
|
|
1842
|
+
|
|
1843
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1844
|
+
# @return [Hash]
|
|
1845
|
+
def to_hash
|
|
1846
|
+
{
|
|
1847
|
+
'onentry' => (@onentry || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1848
|
+
'onexit' => (@onexit || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1849
|
+
'transition' => (@transition || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1850
|
+
'initial' => (@initial || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1851
|
+
'state' => (@state || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1852
|
+
'parallel' => (@parallel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1853
|
+
'final' => (@final || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1854
|
+
'history' => (@history || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1855
|
+
'datamodel' => (@datamodel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1856
|
+
'invoke' => (@invoke || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1857
|
+
'other_element' => @other_element,
|
|
1858
|
+
'id' => @id,
|
|
1859
|
+
'initial_attribute' => @initial_attribute,
|
|
1860
|
+
'other_attributes' => @other_attributes
|
|
1861
|
+
}
|
|
1862
|
+
end
|
|
1863
|
+
|
|
1864
|
+
# Serialize the object to JSON.
|
|
1865
|
+
# @param opts [Array] JSON generation options.
|
|
1866
|
+
# @return [String]
|
|
1867
|
+
def to_json(*opts)
|
|
1868
|
+
JSON.generate(to_hash, *opts)
|
|
1869
|
+
end
|
|
1870
|
+
end
|
|
1871
|
+
|
|
1872
|
+
# Collection alias for StateProps values.
|
|
1873
|
+
StateArray = ::Array
|
|
1874
|
+
|
|
1875
|
+
# Structured type for scjson elements.
|
|
1876
|
+
class TransitionProps
|
|
1877
|
+
attr_accessor :other_element, :raise_value, :if_value, :foreach, :send, :script, :assign, :log, :cancel, :event, :cond, :target, :type_value, :other_attributes
|
|
1878
|
+
# Instantiate a new TransitionProps object.
|
|
1879
|
+
# @param kwargs [Hash] Optional keyword overrides.
|
|
1880
|
+
def initialize(**kwargs)
|
|
1881
|
+
@other_element = kwargs.fetch(:other_element, [])
|
|
1882
|
+
@raise_value = kwargs.fetch(:raise_value, [])
|
|
1883
|
+
@if_value = kwargs.fetch(:if_value, [])
|
|
1884
|
+
@foreach = kwargs.fetch(:foreach, [])
|
|
1885
|
+
@send = kwargs.fetch(:send, [])
|
|
1886
|
+
@script = kwargs.fetch(:script, [])
|
|
1887
|
+
@assign = kwargs.fetch(:assign, [])
|
|
1888
|
+
@log = kwargs.fetch(:log, [])
|
|
1889
|
+
@cancel = kwargs.fetch(:cancel, [])
|
|
1890
|
+
@event = kwargs.fetch(:event, nil)
|
|
1891
|
+
@cond = kwargs.fetch(:cond, nil)
|
|
1892
|
+
@target = kwargs.fetch(:target, [])
|
|
1893
|
+
@type_value = kwargs.fetch(:type_value, nil)
|
|
1894
|
+
@other_attributes = kwargs.fetch(:other_attributes, {})
|
|
1895
|
+
end
|
|
1896
|
+
|
|
1897
|
+
# Build an instance from a Hash representation.
|
|
1898
|
+
# @param data [Hash] Canonical hash representation.
|
|
1899
|
+
# @return [TransitionProps]
|
|
1900
|
+
def self.from_hash(data)
|
|
1901
|
+
raise ArgumentError, 'Expected Hash' unless data.is_a?(Hash)
|
|
1902
|
+
|
|
1903
|
+
normalized = data.transform_keys(&:to_s)
|
|
1904
|
+
kwargs = {}
|
|
1905
|
+
kwargs[:other_element] = Array(normalized.fetch('other_element', []))
|
|
1906
|
+
kwargs[:raise_value] = Array(normalized.fetch('raise_value', [])).map { |item| RaiseProps.from_hash(item) }
|
|
1907
|
+
kwargs[:if_value] = Array(normalized.fetch('if_value', [])).map { |item| IfProps.from_hash(item) }
|
|
1908
|
+
kwargs[:foreach] = Array(normalized.fetch('foreach', [])).map { |item| ForeachProps.from_hash(item) }
|
|
1909
|
+
kwargs[:send] = Array(normalized.fetch('send', [])).map { |item| SendProps.from_hash(item) }
|
|
1910
|
+
kwargs[:script] = Array(normalized.fetch('script', [])).map { |item| ScriptProps.from_hash(item) }
|
|
1911
|
+
kwargs[:assign] = Array(normalized.fetch('assign', [])).map { |item| AssignProps.from_hash(item) }
|
|
1912
|
+
kwargs[:log] = Array(normalized.fetch('log', [])).map { |item| LogProps.from_hash(item) }
|
|
1913
|
+
kwargs[:cancel] = Array(normalized.fetch('cancel', [])).map { |item| CancelProps.from_hash(item) }
|
|
1914
|
+
kwargs[:event] = normalized.fetch('event', nil)
|
|
1915
|
+
kwargs[:cond] = normalized.fetch('cond', nil)
|
|
1916
|
+
kwargs[:target] = Array(normalized.fetch('target', []))
|
|
1917
|
+
kwargs[:type_value] = normalized.key?('type_value') ? TransitionTypeDatatypeProps.coerce(normalized['type_value'], allow_nil: true) : nil
|
|
1918
|
+
kwargs[:other_attributes] = normalized.fetch('other_attributes', {})
|
|
1919
|
+
new(**kwargs)
|
|
1920
|
+
end
|
|
1921
|
+
|
|
1922
|
+
# Deserialize an instance from a JSON payload.
|
|
1923
|
+
# @param json [String] JSON document to decode.
|
|
1924
|
+
# @return [TransitionProps]
|
|
1925
|
+
def self.from_json(json)
|
|
1926
|
+
parsed = JSON.parse(json)
|
|
1927
|
+
from_hash(parsed)
|
|
1928
|
+
end
|
|
1929
|
+
|
|
1930
|
+
# Convert the object to a Hash suitable for JSON serialization.
|
|
1931
|
+
# @return [Hash]
|
|
1932
|
+
def to_hash
|
|
1933
|
+
{
|
|
1934
|
+
'other_element' => @other_element,
|
|
1935
|
+
'raise_value' => (@raise_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1936
|
+
'if_value' => (@if_value || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1937
|
+
'foreach' => (@foreach || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1938
|
+
'send' => (@send || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1939
|
+
'script' => (@script || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1940
|
+
'assign' => (@assign || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1941
|
+
'log' => (@log || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1942
|
+
'cancel' => (@cancel || []).map { |item| item.respond_to?(:to_hash) ? item.to_hash : item },
|
|
1943
|
+
'event' => @event,
|
|
1944
|
+
'cond' => @cond,
|
|
1945
|
+
'target' => @target,
|
|
1946
|
+
'type_value' => @type_value,
|
|
1947
|
+
'other_attributes' => @other_attributes
|
|
1948
|
+
}
|
|
1949
|
+
end
|
|
1950
|
+
|
|
1951
|
+
# Serialize the object to JSON.
|
|
1952
|
+
# @param opts [Array] JSON generation options.
|
|
1953
|
+
# @return [String]
|
|
1954
|
+
def to_json(*opts)
|
|
1955
|
+
JSON.generate(to_hash, *opts)
|
|
1956
|
+
end
|
|
1957
|
+
end
|
|
1958
|
+
|
|
1959
|
+
# Collection alias for TransitionProps values.
|
|
1960
|
+
TransitionArray = ::Array
|
|
1961
|
+
|
|
1962
|
+
end
|
|
1963
|
+
end
|
|
1964
|
+
|