bcdd-result 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +19 -9
- data/README.md +168 -5
- data/Steepfile +2 -2
- data/lib/bcdd/result/config/switchers/addons.rb +20 -0
- data/lib/bcdd/result/config/{constant_alias.rb → switchers/constant_aliases.rb} +4 -4
- data/lib/bcdd/result/config/switchers/features.rb +28 -0
- data/lib/bcdd/result/config/switchers/pattern_matching.rb +20 -0
- data/lib/bcdd/result/config.rb +8 -28
- data/lib/bcdd/result/context.rb +10 -15
- data/lib/bcdd/result/transitions/tracking/disabled.rb +17 -0
- data/lib/bcdd/result/transitions/tracking/enabled.rb +80 -0
- data/lib/bcdd/result/transitions/tracking.rb +20 -0
- data/lib/bcdd/result/transitions/tree.rb +95 -0
- data/lib/bcdd/result/transitions.rb +30 -0
- data/lib/bcdd/result/version.rb +1 -1
- data/lib/bcdd/result.rb +27 -16
- data/sig/bcdd/result/config.rbs +100 -0
- data/sig/bcdd/result/context.rbs +102 -0
- data/sig/bcdd/result/contract.rbs +119 -0
- data/sig/bcdd/result/data.rbs +16 -0
- data/sig/bcdd/result/error.rbs +31 -0
- data/sig/bcdd/result/expectations.rbs +67 -0
- data/sig/bcdd/result/handler.rbs +47 -0
- data/sig/bcdd/result/mixin.rbs +37 -0
- data/sig/bcdd/result/transitions.rbs +89 -0
- data/sig/bcdd/result/version.rbs +5 -0
- data/sig/bcdd/result.rbs +4 -516
- metadata +22 -4
@@ -0,0 +1,37 @@
|
|
1
|
+
class BCDD::Result
|
2
|
+
module Mixin
|
3
|
+
module Factory
|
4
|
+
def self.module!: -> Module
|
5
|
+
end
|
6
|
+
|
7
|
+
module Methods
|
8
|
+
def Success: (Symbol type, ?untyped value) -> BCDD::Result::Success
|
9
|
+
|
10
|
+
def Failure: (Symbol type, ?untyped value) -> BCDD::Result::Failure
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def _ResultAs: (singleton(BCDD::Result), Symbol, untyped, ?halted: bool) -> untyped
|
15
|
+
end
|
16
|
+
|
17
|
+
module Addons
|
18
|
+
module Continuable
|
19
|
+
include BCDD::Result::Mixin::Methods
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def Continue: (untyped) -> BCDD::Result::Success
|
24
|
+
end
|
25
|
+
|
26
|
+
OPTIONS: Hash[Symbol, Module]
|
27
|
+
|
28
|
+
def self.options: (Hash[Symbol, Hash[Symbol, bool]]) -> Hash[Symbol, Module]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.mixin: (?config: Hash[Symbol, Hash[Symbol, bool]]) -> Module
|
33
|
+
|
34
|
+
def self.mixin_module: -> singleton(BCDD::Result::Mixin)
|
35
|
+
|
36
|
+
def self.result_factory: -> singleton(BCDD::Result)
|
37
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class BCDD::Result
|
2
|
+
module Transitions
|
3
|
+
class Tree
|
4
|
+
class Node
|
5
|
+
attr_reader id: Integer
|
6
|
+
attr_reader value: untyped
|
7
|
+
attr_reader parent: (Node | nil)
|
8
|
+
attr_reader normalizer: ^(Integer, Array[untyped]) -> untyped
|
9
|
+
attr_reader children: Array[Node]
|
10
|
+
|
11
|
+
def initialize: (
|
12
|
+
untyped value,
|
13
|
+
parent: (Node | nil),
|
14
|
+
id: Integer,
|
15
|
+
normalizer: ^(Integer, Array[untyped]) -> untyped
|
16
|
+
) -> void
|
17
|
+
|
18
|
+
def insert: (untyped, id: Integer) -> Node
|
19
|
+
|
20
|
+
def root?: () -> bool
|
21
|
+
def leaf?: () -> bool
|
22
|
+
def node?: () -> bool
|
23
|
+
def inspect: () -> String
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader size: Integer
|
27
|
+
attr_reader root: Node
|
28
|
+
attr_reader current: Node
|
29
|
+
|
30
|
+
def initialize: (untyped, ?normalizer: ^(Integer, Array[untyped]) -> untyped) -> void
|
31
|
+
def root_value: () -> untyped
|
32
|
+
def parent_value: () -> untyped
|
33
|
+
def current_value: () -> untyped
|
34
|
+
def insert: (untyped) -> Node
|
35
|
+
def insert!: (untyped) -> Node
|
36
|
+
def move_up!: (?Integer level) -> Tree
|
37
|
+
def move_down!: (?Integer level) -> Tree
|
38
|
+
def move_to_root!: () -> Tree
|
39
|
+
|
40
|
+
NestedIds: ^(Node) -> Array[untyped]
|
41
|
+
|
42
|
+
def nested_ids: () -> Array[untyped]
|
43
|
+
end
|
44
|
+
|
45
|
+
module Tracking
|
46
|
+
EMPTY_ARRAY: Array[untyped]
|
47
|
+
EMPTY_HASH: Hash[untyped, untyped]
|
48
|
+
EMPTY_TREE: Transitions::Tree
|
49
|
+
VERSION: Integer
|
50
|
+
EMPTY: Hash[Symbol, untyped]
|
51
|
+
|
52
|
+
class Enabled
|
53
|
+
private attr_accessor tree: Transitions::Tree
|
54
|
+
private attr_accessor records: Array[Hash[Symbol, untyped]]
|
55
|
+
private attr_accessor root_started_at: Integer
|
56
|
+
|
57
|
+
def start: (name: String, desc: String) -> void
|
58
|
+
def finish: (result: BCDD::Result) -> void
|
59
|
+
def reset!: () -> void
|
60
|
+
def record: (BCDD::Result) -> void
|
61
|
+
def record_and_then: ((untyped), untyped, untyped) { () -> BCDD::Result } -> BCDD::Result
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
TreeNodeValueNormalizer: ^(Integer, Array[untyped]) -> untyped
|
66
|
+
|
67
|
+
def root_start: (Array[untyped]) -> void
|
68
|
+
|
69
|
+
def track: (BCDD::Result, time: Time) -> void
|
70
|
+
|
71
|
+
def now_in_milliseconds: () -> Integer
|
72
|
+
end
|
73
|
+
|
74
|
+
module Disabled
|
75
|
+
def self.start: (name: String, desc: String) -> void
|
76
|
+
def self.finish: (result: BCDD::Result) -> void
|
77
|
+
def self.reset!: () -> void
|
78
|
+
def self.record: (BCDD::Result) -> void
|
79
|
+
def self.record_and_then: ((untyped), untyped, untyped) { () -> BCDD::Result } -> BCDD::Result
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.instance: () -> (Enabled | singleton(Disabled))
|
83
|
+
end
|
84
|
+
|
85
|
+
THREAD_VAR_NAME: Symbol
|
86
|
+
|
87
|
+
def self.tracking: () -> (Tracking::Enabled | singleton(Tracking::Disabled))
|
88
|
+
end
|
89
|
+
end
|
data/sig/bcdd/result.rbs
CHANGED
@@ -1,16 +1,12 @@
|
|
1
|
-
module BCDD
|
2
|
-
class Result
|
3
|
-
VERSION: String
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
1
|
class BCDD::Result
|
8
2
|
private attr_accessor unknown: bool
|
3
|
+
private attr_writer transitions: Hash[Symbol, untyped]
|
9
4
|
private attr_reader type_checker: BCDD::Result::Contract::TypeChecker
|
10
5
|
|
11
6
|
attr_reader data: BCDD::Result::Data
|
12
7
|
attr_reader subject: untyped
|
13
8
|
attr_reader halted: bool
|
9
|
+
attr_reader transitions: Hash[Symbol, untyped]
|
14
10
|
|
15
11
|
def self.config: -> BCDD::Result::Config
|
16
12
|
def self.configuration: { (BCDD::Result::Config) -> void } -> BCDD::Result::Config
|
@@ -56,8 +52,9 @@ class BCDD::Result
|
|
56
52
|
def kind: -> Symbol
|
57
53
|
def known: (Proc) -> untyped
|
58
54
|
def call_and_then_subject_method: (Symbol, untyped) -> BCDD::Result
|
55
|
+
def call_and_then_subject_method!: (untyped, untyped) -> BCDD::Result
|
59
56
|
def call_and_then_block: (untyped) -> BCDD::Result
|
60
|
-
def call_and_then_block!: (untyped
|
57
|
+
def call_and_then_block!: (untyped) -> BCDD::Result
|
61
58
|
def ensure_result_object: (untyped, origin: Symbol) -> BCDD::Result
|
62
59
|
end
|
63
60
|
|
@@ -81,7 +78,6 @@ class BCDD::Result
|
|
81
78
|
def self.Failure: (Symbol type, ?untyped value) -> BCDD::Result::Failure
|
82
79
|
end
|
83
80
|
|
84
|
-
|
85
81
|
class BCDD::Result
|
86
82
|
class Failure < BCDD::Result
|
87
83
|
module Methods
|
@@ -101,511 +97,3 @@ class BCDD::Result
|
|
101
97
|
|
102
98
|
def self.Success: (Symbol type, ?untyped value) -> BCDD::Result::Success
|
103
99
|
end
|
104
|
-
|
105
|
-
class BCDD::Result
|
106
|
-
module Mixin
|
107
|
-
module Factory
|
108
|
-
def self.module!: -> Module
|
109
|
-
end
|
110
|
-
|
111
|
-
module Methods
|
112
|
-
def Success: (Symbol type, ?untyped value) -> BCDD::Result::Success
|
113
|
-
|
114
|
-
def Failure: (Symbol type, ?untyped value) -> BCDD::Result::Failure
|
115
|
-
|
116
|
-
private
|
117
|
-
|
118
|
-
def _ResultAs: (singleton(BCDD::Result), Symbol, untyped, ?halted: bool) -> untyped
|
119
|
-
end
|
120
|
-
|
121
|
-
module Addons
|
122
|
-
module Continuable
|
123
|
-
include BCDD::Result::Mixin::Methods
|
124
|
-
|
125
|
-
private
|
126
|
-
|
127
|
-
def Continue: (untyped) -> BCDD::Result::Success
|
128
|
-
end
|
129
|
-
|
130
|
-
OPTIONS: Hash[Symbol, Module]
|
131
|
-
|
132
|
-
def self.options: (Hash[Symbol, Hash[Symbol, bool]]) -> Hash[Symbol, Module]
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
def self.mixin: (?config: Hash[Symbol, Hash[Symbol, bool]]) -> Module
|
137
|
-
|
138
|
-
def self.mixin_module: -> singleton(BCDD::Result::Mixin)
|
139
|
-
|
140
|
-
def self.result_factory: -> singleton(BCDD::Result)
|
141
|
-
end
|
142
|
-
|
143
|
-
class BCDD::Result
|
144
|
-
class Data
|
145
|
-
attr_reader kind: Symbol
|
146
|
-
attr_reader type: Symbol
|
147
|
-
attr_reader value: untyped
|
148
|
-
attr_reader to_h: Hash[Symbol, untyped]
|
149
|
-
attr_reader to_a: [Symbol, Symbol, untyped]
|
150
|
-
|
151
|
-
def initialize: (Symbol, Symbol, untyped) -> void
|
152
|
-
|
153
|
-
def inspect: -> String
|
154
|
-
|
155
|
-
alias to_ary to_a
|
156
|
-
alias to_hash to_h
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
class BCDD::Result
|
161
|
-
class Error < StandardError
|
162
|
-
def self.build: (**untyped) -> BCDD::Result::Error
|
163
|
-
|
164
|
-
class NotImplemented < BCDD::Result::Error
|
165
|
-
end
|
166
|
-
|
167
|
-
class MissingTypeArgument < BCDD::Result::Error
|
168
|
-
end
|
169
|
-
|
170
|
-
class UnexpectedOutcome < BCDD::Result::Error
|
171
|
-
def self.build: (outcome: untyped, origin: Symbol, ?expected: String)
|
172
|
-
-> BCDD::Result::Error::UnexpectedOutcome
|
173
|
-
end
|
174
|
-
|
175
|
-
class InvalidResultSubject < BCDD::Result::Error
|
176
|
-
def self.build: (given_result: BCDD::Result, expected_subject: untyped)
|
177
|
-
-> BCDD::Result::Error::InvalidResultSubject
|
178
|
-
end
|
179
|
-
|
180
|
-
class InvalidSubjectMethodArity < BCDD::Result::Error
|
181
|
-
def self.build: (subject: untyped, method: Method, max_arity: Integer)
|
182
|
-
-> BCDD::Result::Error::InvalidSubjectMethodArity
|
183
|
-
end
|
184
|
-
|
185
|
-
class UnhandledTypes < BCDD::Result::Error
|
186
|
-
def self.build: (types: Set[Symbol])
|
187
|
-
-> BCDD::Result::Error::UnhandledTypes
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
class BCDD::Result
|
193
|
-
class Handler
|
194
|
-
UNDEFINED: Object
|
195
|
-
|
196
|
-
def initialize: (
|
197
|
-
BCDD::Result,
|
198
|
-
type_checker: BCDD::Result::Contract::TypeChecker
|
199
|
-
) -> void
|
200
|
-
|
201
|
-
def []: (*Symbol) { (untyped, Symbol) -> void } -> untyped
|
202
|
-
def failure: (*Symbol) { (untyped, Symbol) -> void } -> untyped
|
203
|
-
def success: (*Symbol) { (untyped, Symbol) -> void } -> untyped
|
204
|
-
def unknown: () { (untyped, Symbol) -> void } -> untyped
|
205
|
-
|
206
|
-
alias type []
|
207
|
-
|
208
|
-
private
|
209
|
-
|
210
|
-
attr_reader result: BCDD::Result
|
211
|
-
attr_reader allowed_types: BCDD::Result::Handler::AllowedTypes
|
212
|
-
|
213
|
-
def outcome?: -> bool
|
214
|
-
def outcome=: (Proc) -> void
|
215
|
-
def outcome: -> untyped
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
class BCDD::Result::Handler
|
220
|
-
class AllowedTypes
|
221
|
-
attr_reader unchecked: Set[Symbol]
|
222
|
-
attr_reader type_checker: BCDD::Result::Contract::TypeChecker
|
223
|
-
|
224
|
-
def initialize: (
|
225
|
-
BCDD::Result::Contract::TypeChecker
|
226
|
-
) -> void
|
227
|
-
|
228
|
-
def allow?: (Array[Symbol]) -> bool
|
229
|
-
def allow_success?: (Array[Symbol]) -> bool
|
230
|
-
def allow_failure?: (Array[Symbol]) -> bool
|
231
|
-
|
232
|
-
def all_checked?: -> bool
|
233
|
-
|
234
|
-
private
|
235
|
-
|
236
|
-
def check!: (Array[Symbol], bool) -> bool
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
module BCDD::Result::Contract
|
241
|
-
NONE: BCDD::Result::Contract::Evaluator
|
242
|
-
|
243
|
-
def self.evaluate: (
|
244
|
-
BCDD::Result::Data,
|
245
|
-
BCDD::Result::Contract::Evaluator
|
246
|
-
) -> BCDD::Result::Contract::TypeChecker
|
247
|
-
|
248
|
-
ToEnsure: ^(Hash[Symbol, untyped] | Array[Symbol], Hash[Symbol, Hash[Symbol, bool]])
|
249
|
-
-> BCDD::Result::Contract::Interface
|
250
|
-
|
251
|
-
def self.new: (
|
252
|
-
success: Hash[Symbol, untyped] | Array[Symbol],
|
253
|
-
failure: Hash[Symbol, untyped] | Array[Symbol],
|
254
|
-
config: Hash[Symbol, Hash[Symbol, bool]]
|
255
|
-
) -> BCDD::Result::Contract::Evaluator
|
256
|
-
end
|
257
|
-
|
258
|
-
module BCDD::Result::Contract
|
259
|
-
class TypeChecker
|
260
|
-
attr_reader result_type: Symbol
|
261
|
-
attr_reader expectations: BCDD::Result::Contract::Evaluator
|
262
|
-
|
263
|
-
def initialize: (
|
264
|
-
Symbol,
|
265
|
-
expectations: BCDD::Result::Contract::Evaluator
|
266
|
-
) -> void
|
267
|
-
|
268
|
-
def allow?: (Array[Symbol]) -> bool
|
269
|
-
def allow_success?: (Array[Symbol]) -> bool
|
270
|
-
def allow_failure?: (Array[Symbol]) -> bool
|
271
|
-
|
272
|
-
private
|
273
|
-
|
274
|
-
def validate: (
|
275
|
-
Array[Symbol],
|
276
|
-
expected: BCDD::Result::Contract::Interface,
|
277
|
-
allow_empty: bool
|
278
|
-
) -> bool
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
class BCDD::Result::Contract::Error < BCDD::Result::Error
|
283
|
-
class UnexpectedType < BCDD::Result::Contract::Error
|
284
|
-
def self.build: (type: Symbol, allowed_types: Set[Symbol])
|
285
|
-
-> BCDD::Result::Contract::Error::UnexpectedType
|
286
|
-
end
|
287
|
-
|
288
|
-
class UnexpectedValue < BCDD::Result::Contract::Error
|
289
|
-
def self.build: (type: Symbol, value: untyped, ?cause: Exception)
|
290
|
-
-> BCDD::Result::Contract::Error::UnexpectedValue
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
module BCDD::Result::Contract
|
295
|
-
module Interface
|
296
|
-
def ==: (BCDD::Result::Contract::Interface) -> bool
|
297
|
-
|
298
|
-
def allowed_types: -> Set[Symbol]
|
299
|
-
|
300
|
-
def type?: (Symbol) -> bool
|
301
|
-
|
302
|
-
def type!: (Symbol) -> Symbol
|
303
|
-
|
304
|
-
def type_and_value!: (BCDD::Result::Data) -> void
|
305
|
-
|
306
|
-
def !=: (untyped) -> bool
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
module BCDD::Result::Contract
|
311
|
-
module Disabled
|
312
|
-
extend Interface
|
313
|
-
|
314
|
-
EMPTY_SET: Set[Symbol]
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
module BCDD::Result::Contract
|
319
|
-
class ForTypes
|
320
|
-
include Interface
|
321
|
-
|
322
|
-
def initialize: (Array[Symbol]) -> void
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
module BCDD::Result::Contract
|
327
|
-
class ForTypesAndValues
|
328
|
-
include Interface
|
329
|
-
|
330
|
-
def initialize: (
|
331
|
-
Hash[Symbol, untyped],
|
332
|
-
Hash[Symbol, Hash[Symbol, bool]]
|
333
|
-
) -> void
|
334
|
-
|
335
|
-
private
|
336
|
-
|
337
|
-
def nil_as_valid_value_checking?: -> bool
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
module BCDD::Result::Contract
|
342
|
-
class Evaluator
|
343
|
-
include Interface
|
344
|
-
|
345
|
-
attr_reader allowed_types: Set[Symbol]
|
346
|
-
attr_reader success: BCDD::Result::Contract::Interface
|
347
|
-
attr_reader failure: BCDD::Result::Contract::Interface
|
348
|
-
|
349
|
-
def initialize: (
|
350
|
-
BCDD::Result::Contract::Interface,
|
351
|
-
BCDD::Result::Contract::Interface
|
352
|
-
) -> void
|
353
|
-
|
354
|
-
private
|
355
|
-
|
356
|
-
def for: (BCDD::Result::Data) -> BCDD::Result::Contract::Interface
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
class BCDD::Result::Expectations
|
361
|
-
def self.mixin: (
|
362
|
-
?config: Hash[Symbol, Hash[Symbol, bool]],
|
363
|
-
?success: Hash[Symbol, untyped] | Array[Symbol],
|
364
|
-
?failure: Hash[Symbol, untyped] | Array[Symbol]
|
365
|
-
) -> Module
|
366
|
-
|
367
|
-
def self.mixin!: (
|
368
|
-
?config: Hash[Symbol, Hash[Symbol, bool]],
|
369
|
-
?success: Hash[Symbol, untyped] | Array[Symbol],
|
370
|
-
?failure: Hash[Symbol, untyped] | Array[Symbol]
|
371
|
-
) -> Module
|
372
|
-
|
373
|
-
def self.mixin_module: -> singleton(BCDD::Result::Expectations::Mixin)
|
374
|
-
|
375
|
-
def self.result_factory_without_expectations: -> singleton(BCDD::Result)
|
376
|
-
|
377
|
-
def self.new: (
|
378
|
-
?subject: untyped,
|
379
|
-
?contract: BCDD::Result::Contract::Evaluator,
|
380
|
-
?halted: bool,
|
381
|
-
**untyped
|
382
|
-
) -> (BCDD::Result::Expectations | untyped)
|
383
|
-
|
384
|
-
def initialize: (
|
385
|
-
?subject: untyped,
|
386
|
-
?contract: BCDD::Result::Contract::Evaluator,
|
387
|
-
?halted: bool,
|
388
|
-
**untyped
|
389
|
-
) -> void
|
390
|
-
|
391
|
-
def Success: (Symbol, ?untyped) -> BCDD::Result::Success
|
392
|
-
def Failure: (Symbol, ?untyped) -> BCDD::Result::Failure
|
393
|
-
|
394
|
-
def with: (subject: untyped) -> BCDD::Result::Expectations
|
395
|
-
|
396
|
-
private
|
397
|
-
|
398
|
-
def _ResultAs: (singleton(BCDD::Result), Symbol, untyped) -> untyped
|
399
|
-
|
400
|
-
attr_reader subject: untyped
|
401
|
-
attr_reader contract: BCDD::Result::Contract::Evaluator
|
402
|
-
attr_reader halted: bool
|
403
|
-
end
|
404
|
-
|
405
|
-
module BCDD::Result::Expectations::Mixin
|
406
|
-
module Factory
|
407
|
-
def self.module!: -> Module
|
408
|
-
end
|
409
|
-
|
410
|
-
module Methods
|
411
|
-
BASE: String
|
412
|
-
FACTORY: String
|
413
|
-
|
414
|
-
def self.to_eval: (Hash[Symbol, untyped]) -> String
|
415
|
-
end
|
416
|
-
|
417
|
-
module Addons
|
418
|
-
module Continuable
|
419
|
-
private def Continue: (untyped) -> BCDD::Result::Success
|
420
|
-
end
|
421
|
-
|
422
|
-
OPTIONS: Hash[Symbol, Module]
|
423
|
-
|
424
|
-
def self.options: (Hash[Symbol, Hash[Symbol, bool]]) -> Hash[Symbol, Module]
|
425
|
-
end
|
426
|
-
end
|
427
|
-
|
428
|
-
class BCDD::Result::Context < BCDD::Result
|
429
|
-
EXPECTED_OUTCOME: String
|
430
|
-
|
431
|
-
SubjectMethodArity: ^(Method) -> Integer
|
432
|
-
|
433
|
-
attr_reader acc: Hash[Symbol, untyped]
|
434
|
-
|
435
|
-
def initialize: (
|
436
|
-
type: Symbol,
|
437
|
-
value: untyped,
|
438
|
-
?subject: untyped,
|
439
|
-
?expectations: BCDD::Result::Contract::Evaluator,
|
440
|
-
?halted: bool
|
441
|
-
) -> void
|
442
|
-
|
443
|
-
def and_then: (?Symbol, **untyped) ?{ (Hash[Symbol, untyped]) -> untyped } -> BCDD::Result::Context
|
444
|
-
|
445
|
-
private
|
446
|
-
|
447
|
-
def call_and_then_subject_method: (Symbol, Hash[Symbol, untyped]) -> BCDD::Result::Context
|
448
|
-
def ensure_result_object: (untyped, origin: Symbol) -> BCDD::Result::Context
|
449
|
-
|
450
|
-
def raise_unexpected_outcome_error: (BCDD::Result::Context | untyped, Symbol) -> void
|
451
|
-
end
|
452
|
-
|
453
|
-
class BCDD::Result::Context
|
454
|
-
class Success < BCDD::Result::Context
|
455
|
-
include BCDD::Result::Success::Methods
|
456
|
-
|
457
|
-
def and_expose: (Symbol, Array[Symbol], halted: bool) -> BCDD::Result::Context::Success
|
458
|
-
end
|
459
|
-
|
460
|
-
def self.Success: (Symbol, **untyped) -> BCDD::Result::Context::Success
|
461
|
-
end
|
462
|
-
|
463
|
-
class BCDD::Result::Context
|
464
|
-
class Failure < BCDD::Result::Context
|
465
|
-
include BCDD::Result::Failure::Methods
|
466
|
-
|
467
|
-
def and_expose: (Symbol, Array[Symbol], **untyped) -> BCDD::Result::Context::Failure
|
468
|
-
end
|
469
|
-
|
470
|
-
def self.Failure: (Symbol, **untyped) -> BCDD::Result::Context::Failure
|
471
|
-
end
|
472
|
-
|
473
|
-
class BCDD::Result::Context
|
474
|
-
module Mixin
|
475
|
-
Factory: singleton(BCDD::Result::Mixin::Factory)
|
476
|
-
|
477
|
-
module Methods
|
478
|
-
def Success: (Symbol, **untyped) -> BCDD::Result::Context::Success
|
479
|
-
|
480
|
-
def Failure: (Symbol, **untyped) -> BCDD::Result::Context::Failure
|
481
|
-
|
482
|
-
private
|
483
|
-
|
484
|
-
def _ResultAs: (singleton(BCDD::Result::Context), Symbol, untyped, ?halted: bool) -> untyped
|
485
|
-
end
|
486
|
-
|
487
|
-
module Addons
|
488
|
-
module Continuable
|
489
|
-
include BCDD::Result::Context::Mixin::Methods
|
490
|
-
|
491
|
-
private
|
492
|
-
|
493
|
-
def Continue: (**untyped) -> BCDD::Result::Context::Success
|
494
|
-
end
|
495
|
-
|
496
|
-
OPTIONS: Hash[Symbol, Module]
|
497
|
-
|
498
|
-
def self.options: (Hash[Symbol, Hash[Symbol, bool]]) -> Hash[Symbol, Module]
|
499
|
-
end
|
500
|
-
end
|
501
|
-
|
502
|
-
def self.mixin_module: -> singleton(BCDD::Result::Context::Mixin)
|
503
|
-
|
504
|
-
def self.result_factory: -> singleton(BCDD::Result::Context)
|
505
|
-
end
|
506
|
-
|
507
|
-
class BCDD::Result::Context::Expectations < BCDD::Result::Expectations
|
508
|
-
def self.mixin_module: -> singleton(BCDD::Result::Context::Expectations::Mixin)
|
509
|
-
|
510
|
-
def self.result_factory_without_expectations: -> singleton(BCDD::Result)
|
511
|
-
|
512
|
-
def Success: (Symbol, **untyped) -> BCDD::Result::Context::Success
|
513
|
-
def Failure: (Symbol, **untyped) -> BCDD::Result::Context::Failure
|
514
|
-
end
|
515
|
-
|
516
|
-
module BCDD::Result::Context::Expectations::Mixin
|
517
|
-
Methods: singleton(BCDD::Result::Expectations::Mixin::Methods)
|
518
|
-
Factory: singleton(BCDD::Result::Expectations::Mixin::Factory)
|
519
|
-
|
520
|
-
module Addons
|
521
|
-
module Continuable
|
522
|
-
private def Continue: (**untyped) -> BCDD::Result::Context::Success
|
523
|
-
end
|
524
|
-
|
525
|
-
OPTIONS: Hash[Symbol, Module]
|
526
|
-
|
527
|
-
def self.options: (Hash[Symbol, Hash[Symbol, bool]]) -> Hash[Symbol, Module]
|
528
|
-
end
|
529
|
-
end
|
530
|
-
|
531
|
-
class BCDD::Result::Config
|
532
|
-
include Singleton
|
533
|
-
|
534
|
-
ADDON: Hash[Symbol, Hash[Symbol, untyped]]
|
535
|
-
FEATURE: Hash[Symbol, Hash[Symbol, untyped]]
|
536
|
-
PATTERN_MATCHING: Hash[Symbol, Hash[Symbol, untyped]]
|
537
|
-
|
538
|
-
attr_reader addon: BCDD::Result::Config::Switcher
|
539
|
-
attr_reader feature: BCDD::Result::Config::Switcher
|
540
|
-
attr_reader constant_alias: BCDD::Result::Config::Switcher
|
541
|
-
attr_reader pattern_matching: BCDD::Result::Config::Switcher
|
542
|
-
|
543
|
-
def self.instance: -> BCDD::Result::Config
|
544
|
-
|
545
|
-
def initialize: -> void
|
546
|
-
|
547
|
-
def freeze: -> BCDD::Result::Config
|
548
|
-
def options: -> Hash[Symbol, BCDD::Result::Config::Switcher]
|
549
|
-
def to_h: -> Hash[Symbol, Hash[Symbol | String, bool]]
|
550
|
-
end
|
551
|
-
|
552
|
-
class BCDD::Result::Config::Switcher
|
553
|
-
private attr_reader _affects: Hash[Symbol | String, Array[String]]
|
554
|
-
private attr_reader _options: Hash[Symbol | String, bool]
|
555
|
-
private attr_reader listener: Proc
|
556
|
-
|
557
|
-
def initialize: (
|
558
|
-
options: Hash[Symbol | String, Hash[Symbol, untyped]],
|
559
|
-
?listener: Proc
|
560
|
-
) -> void
|
561
|
-
|
562
|
-
def freeze: -> BCDD::Result::Config::Switcher
|
563
|
-
|
564
|
-
def to_h: -> Hash[Symbol | String, bool]
|
565
|
-
|
566
|
-
def options: -> Hash[Symbol | String, Hash[Symbol, untyped]]
|
567
|
-
|
568
|
-
def enabled?: (Symbol | String) -> bool
|
569
|
-
|
570
|
-
def enable!: (*(Symbol | String)) -> Hash[Symbol | String, Hash[Symbol, untyped]]
|
571
|
-
|
572
|
-
def disable!: (*(Symbol | String)) -> Hash[Symbol | String, Hash[Symbol, untyped]]
|
573
|
-
|
574
|
-
private
|
575
|
-
|
576
|
-
def set_many: (Array[Symbol | String], to: bool) -> Hash[Symbol | String, Hash[Symbol, untyped]]
|
577
|
-
|
578
|
-
def set_one: (Symbol | String, bool) -> void
|
579
|
-
|
580
|
-
def require_option!: (Array[Symbol | String]) -> void
|
581
|
-
|
582
|
-
def validate_option!: (Symbol | String) -> void
|
583
|
-
|
584
|
-
def available_options_message: -> String
|
585
|
-
end
|
586
|
-
|
587
|
-
module BCDD::Result::Config::ConstantAlias
|
588
|
-
MAPPING: Hash[String, Hash[Symbol, untyped]]
|
589
|
-
OPTIONS: Hash[String, Hash[Symbol, untyped]]
|
590
|
-
Listener: Proc
|
591
|
-
|
592
|
-
def self.switcher: -> BCDD::Result::Config::Switcher
|
593
|
-
end
|
594
|
-
|
595
|
-
module BCDD::Result::Config::Options
|
596
|
-
def self.with_defaults: (
|
597
|
-
Hash[Symbol, Hash[Symbol, bool]],
|
598
|
-
Symbol
|
599
|
-
) -> Hash[Symbol, bool]
|
600
|
-
|
601
|
-
def self.select: (
|
602
|
-
Hash[Symbol, Hash[Symbol, bool]],
|
603
|
-
config: Symbol,
|
604
|
-
from: Hash[Symbol, untyped]
|
605
|
-
) -> Hash[Symbol, untyped]
|
606
|
-
|
607
|
-
def self.addon: (
|
608
|
-
map: Hash[Symbol, Hash[Symbol, bool]],
|
609
|
-
from: Hash[Symbol, Module]
|
610
|
-
) -> Hash[Symbol, Module]
|
611
|
-
end
|