potrubi 0.0.3 → 0.0.4

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.
Files changed (48) hide show
  1. data/lib/potrubi.rb +1 -1
  2. data/lib/potrubi/bootstrap.rb +1 -1
  3. data/lib/potrubi/core.rb +3 -3
  4. data/lib/potrubi/dsl.rb +86 -0
  5. data/lib/potrubi/dsl/accessor.rb +76 -0
  6. data/lib/potrubi/dsl/cache_2d.rb +811 -0
  7. data/lib/potrubi/dsl/contract.rb +731 -0
  8. data/lib/potrubi/dsl/super.rb +517 -0
  9. data/lib/potrubi/klass/syntax/alias.rb +150 -0
  10. data/lib/potrubi/klass/syntax/braket.rb +115 -25
  11. data/lib/potrubi/klass/syntax/builder.rb +45 -0
  12. data/lib/potrubi/klass/syntax/method.rb +436 -0
  13. data/lib/potrubi/klass/syntax/mixin/name_generation.rb +85 -0
  14. data/lib/potrubi/klass/syntax/mixin/new_aliases.rb +76 -0
  15. data/lib/potrubi/klass/syntax/mixin/new_brakets.rb +89 -0
  16. data/lib/potrubi/klass/syntax/mixin/new_methods.rb +158 -0
  17. data/lib/potrubi/klass/syntax/mixin/new_snippets.rb +74 -0
  18. data/lib/potrubi/klass/syntax/mixin/new_statements.rb +0 -0
  19. data/lib/potrubi/klass/syntax/mixin/statement_management.rb +69 -0
  20. data/lib/potrubi/klass/syntax/mixin/synel_management.rb +168 -0
  21. data/lib/potrubi/klass/syntax/snippet.rb +386 -0
  22. data/lib/potrubi/klass/syntax/statement.rb +91 -0
  23. data/lib/potrubi/klass/syntax/super.rb +88 -0
  24. data/lib/potrubi/mixin/bootstrap_common.rb +38 -12
  25. data/lib/potrubi/mixin/configuration.rb +31 -3
  26. data/lib/potrubi/mixin/contract.rb +5 -14
  27. data/lib/potrubi/mixin/contract/recipes.rb +307 -0
  28. data/lib/potrubi/mixin/dynamic-recipes.rb +1 -11
  29. data/lib/potrubi/mixin/dynamic.rb +223 -115
  30. data/lib/potrubi/mixin/exception.rb +3 -22
  31. data/lib/potrubi/mixin/filesys.rb +5 -21
  32. data/lib/potrubi/mixin/initialize.rb +11 -6
  33. data/lib/potrubi/mixin/konstant.rb +14 -118
  34. data/lib/potrubi/mixin/logger.rb +28 -41
  35. data/lib/potrubi/mixin/pathandnames.rb +4 -34
  36. data/lib/potrubi/mixin/persistence.rb +115 -10
  37. data/lib/potrubi/mixin/script.rb +0 -5
  38. data/lib/potrubi/mixin/{text-snippets → snippet-dictionaries}/methods-text-snippets.rb +138 -49
  39. data/lib/potrubi/mixin/{text-snippets.rb → snippet-manager.rb} +51 -39
  40. data/lib/potrubi/mixin/util.rb +66 -20
  41. data/lib/potrubi/version.rb +1 -1
  42. data/test/potrubi/mixin/bootstrap_common.rb +205 -0
  43. data/test/potrubi/mixin/konstant.rb +216 -0
  44. data/test/potrubi/mixin/logger.rb +124 -0
  45. data/test/ts_bootstrap_mixins.rb +16 -0
  46. data/test/ts_core_mixins.rb +7 -0
  47. metadata +31 -6
  48. data/lib/potrubi/mixin/contract-recipes.rb +0 -226
@@ -0,0 +1,517 @@
1
+
2
+ # potrubi dsl super
3
+
4
+ # to ease the creation of verbs, accessors, etc in class bodies
5
+
6
+ # Uses conventions for names etc dedined by (in) verb mixin
7
+
8
+ requireList = %w(mixin/util)
9
+ requireList.each {|r| require_relative "../#{r}"}
10
+
11
+ classMethods = Module.new do
12
+
13
+ include Potrubi::Bootstrap
14
+ include Potrubi::Mixin::Util
15
+
16
+ def default_new_verb_args
17
+ @default_new_verb_args ||= {verb: :Super}
18
+ end
19
+
20
+ def new_verb(*dslArgs, &dslBlok) # class method
21
+ eye = :'DSLSpr::n_verb'
22
+
23
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslArgs: dslArgs, dslBlok: dslBlok))
24
+
25
+ dslArgsWork = potrubi_util_merge_hashes_or_croak(default_new_verb_args, dslArgs.flatten.compact)
26
+
27
+ dslVerb = potrubi_bootstrap_mustbe_symbol_or_croak(dslArgsWork && dslArgsWork[:verb], eye).to_s.downcase.to_sym
28
+
29
+ dslClass = case dslVerb
30
+ when :super then Potrubi::DSL::Super
31
+ when :contract then
32
+ require_relative("contract")
33
+ Potrubi::DSL::Contract
34
+ when :accessor then
35
+ require_relative('accessor')
36
+ Potrubi::DSL::Accessor
37
+ when :cache_2d then
38
+ # IS 2D, etc
39
+ require_relative('cache_2d')
40
+ Potrubi::DSL::Cache2D
41
+ else
42
+ potrubi_bootstrap_surprise_exception(dslVerb, eye, "dslVerb is what?")
43
+ end
44
+
45
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, potrubi_bootstrap_logger_fmt_who(dslVerb: dslVerb, dslClass: dslClass, dslArgsWork: dslArgsWork))
46
+
47
+ newVerb = dslClass.new(dslArgsWork, &dslBlok)
48
+
49
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(newVerb: newVerb), potrubi_bootstrap_logger_fmt_who(dslArgs: dslArgs, dslBlok: dslBlok))
50
+
51
+ newVerb
52
+
53
+ end
54
+
55
+ def contract_defaults
56
+ @contract_defaults ||= {
57
+ verb: :contract,
58
+ builder: Potrubi::Mixin::Contract::Recipes,
59
+ builder_data: :recipe_variant_mustbe,
60
+ spec: :package_mustbe,
61
+ }
62
+ end
63
+
64
+ def accessor_defaults
65
+ @accessor_defaults ||= {
66
+ verb: :accessor,
67
+ type: :accessor,
68
+ builder: Potrubi::Mixin::Contract::Recipes,
69
+ builder_data: :recipe_variant_accessor,
70
+ spec: :package_accessor,
71
+ }
72
+ end
73
+
74
+ def cache_defaults
75
+ @cache_defaults ||= {
76
+ verb: :cache_2d, # SHOULD BE 'CACHE' BUT LEAVE FOR NOW
77
+ type: :d2,
78
+ }
79
+ end
80
+
81
+ end
82
+
83
+ instanceMethods = Module.new do
84
+
85
+ include Potrubi::Bootstrap
86
+ include Potrubi::Mixin::Util
87
+
88
+ attr_accessor :name, :type, :target, :verb, :builder, :builder_data
89
+
90
+ attr_accessor :key_name
91
+
92
+ def to_s
93
+ @to_s ||= potrubi_bootstrap_logger_fmt(potrubi_bootstrap_logger_instance_telltale('DSLSpr'), potrubi_bootstrap_logger_fmt(n: name))
94
+ end
95
+
96
+ # Initialization
97
+ # ##############
98
+
99
+ def initialize(dslArgs=nil, &dslBlok)
100
+ eye = :'DSLSpr::i'
101
+
102
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslArgs: dslArgs, dslBlok: dslBlok))
103
+
104
+ case dslArgs
105
+ when NilClass then nil
106
+ when Hash then potrubi_util_set_attributes_or_croak(self, dslArgs)
107
+ else
108
+ potrubi_bootstrap_surprise_exception(dslArgs, eye, "dslArgs is what?")
109
+ end
110
+
111
+ Kernel.block_given? && instance_eval(&dslBlok)
112
+
113
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(subVerbs: get_subverbs.size, dslArgs: dslArgs, dslBlok: dslBlok))
114
+
115
+ end
116
+
117
+ # DSL Verbs
118
+ # #########
119
+
120
+ # These are the "verbs" that can appear in a dsl statement
121
+ # e.g. contract, accessor
122
+
123
+ def contract(dslAttr, dslArgs=nil, &dslBlok)
124
+ eye = :'DSLSpr::ctx'
125
+
126
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslAttr: dslAttr, dslArgs: dslArgs, dslBlok: dslBlok))
127
+
128
+ require 'potrubi/mixin/contract/recipes'
129
+
130
+ dslArgsNrm = normalise_verb_args_or_croak(dslArgs)
131
+
132
+ dslArgsHere = {name: dslAttr, target: target}
133
+
134
+ dslArgsDefs = self.class.contract_defaults
135
+
136
+ newVerb = make_and_add_new_verb(dslArgsDefs, dslArgsHere, dslArgsNrm, &dslBlok)
137
+
138
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(newVerb: newVerb, dslAttr: dslAttr, dslArgs: dslArgs, dslBlok: dslBlok))
139
+
140
+ newVerb
141
+
142
+ end
143
+
144
+ def accessor(dslAttr, dslArgs=nil, &dslBlok)
145
+ eye = :'DSLSpr::acc'
146
+
147
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslAttr: dslAttr, dslArgs: dslArgs, dslBlok: dslBlok))
148
+
149
+ require 'potrubi/mixin/contract/recipes'
150
+
151
+ dslArgsNrm = normalise_verb_args_or_croak(dslArgs)
152
+
153
+ dslArgsHere = {name: dslAttr, target: target}
154
+
155
+ # If no arguments then simple accessor
156
+
157
+ dslArgsBase = self.class.accessor_defaults
158
+
159
+ dslArgsNoCtx = dslArgsBase
160
+ dslArgsWithCtx = dslArgsBase.merge(spec: :package_accessor_with_contract)
161
+
162
+ newVerbs =
163
+ case dslArgsNrm
164
+ when NilClass then make_and_add_new_verb(dslArgsNoCtx, dslArgsHere, dslArgsNrm, &dslBlok) # default is no contract
165
+
166
+ when Hash then
167
+ case
168
+ when dslArgsNrm.has_key?(:type)
169
+
170
+ # get rid of accessor-specifc keys
171
+ ctxDeselectAttrs = [:default]
172
+ ctxArgs = dslArgsNrm.select{|k,v| ! ctxDeselectAttrs.include?(k) }
173
+
174
+ # make two verbs: simple accessor, and the contract
175
+ [make_and_add_new_verb(dslArgsWithCtx, dslArgsHere, dslArgsNrm), # contract accessor - note NO block
176
+ contract(dslAttr, ctxArgs, &dslBlok) # ... and the contract WITH the block
177
+ ]
178
+
179
+ else
180
+ make_and_add_new_verb(dslArgsNoCtx, dslArgsHere, dslArgsNrm, &dslBlok) # default is no contract
181
+ end
182
+
183
+ else
184
+ #{variant: :accessor, name: dslAttr, spec: :package_accessor_with_verb}
185
+ potrubi_bootstrap_surprise_exception(dslArgs, eye, "dslArgs is what?")
186
+ end
187
+
188
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(newVerbs: newVerbs, dslAttr: dslAttr, dslArgs: dslArgs, dslBlok: dslBlok))
189
+
190
+ newVerbs
191
+
192
+ end
193
+
194
+ def cache(dslName, dslArgs=nil, &dslBlok)
195
+ eye = :'DSLSpr::cache'
196
+
197
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslName: dslName, dslArgs: dslArgs, dslBlok: dslBlok))
198
+
199
+ dslArgsNrm = normalise_verb_args_or_croak(dslArgs)
200
+
201
+ dslArgsHere = {name: dslName, target: target}
202
+
203
+ dslArgsDefs = self.class.cache_defaults
204
+
205
+ newVerb = make_and_add_new_verb(dslDefs, dslArgsHere, dslArgsNrm, &dslBlok)
206
+
207
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(newVerb: newVerb, dslName: dslName, dslArgs: dslArgs, dslBlok: dslBlok))
208
+
209
+ newVerb
210
+
211
+ end
212
+
213
+ # Verb Assertion - will be overridden likely
214
+ # ##############
215
+
216
+ # Verbs assert themselves by "executing" their expressions
217
+ # What execution means its up to the type (class) of verb
218
+
219
+ # e.g. for a contract verb, "execution" is the creation
220
+ # of the contract's methods
221
+
222
+ def assert_self_first
223
+ eye = :'DSLSpr::assert_self_first'
224
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(self: self))
225
+ assert_self
226
+ subverbs.each {|v| v.assert}
227
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(self: self))
228
+ self
229
+ end
230
+
231
+ def assert_self_last
232
+ eye = :'DSLSpr::assert_self_last'
233
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(self: self))
234
+ subverbs.each {|v| v.assert}
235
+ assert_self
236
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(self: self))
237
+ self
238
+ end
239
+
240
+ def assert_subverbs
241
+ eye = :'DSLSpr::assert_subverbs'
242
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(self: self))
243
+ subverbs.each {|v| v.assert}
244
+ assert_self
245
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(self: self))
246
+ self
247
+ end
248
+
249
+ # just express - likely overide
250
+ def assert_self
251
+ eye = :'DSLSpr::assert_self'
252
+ exprVerb = express
253
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(self: self, exprVerb: exprVerb))
254
+ exprVerb
255
+ end
256
+ alias_method :assert_self_only, :assert_self
257
+
258
+ # default is subverbs first, then self
259
+ alias_method :assert, :assert_self_last
260
+
261
+ # Verb Expression
262
+ # ###############
263
+
264
+ # Verbs express themselves by calling the handler for their type
265
+
266
+ # the expression of a e.g. contract verb is the description
267
+ # of the contract e.g. {edit: etc spec: :package_mustbe}
268
+
269
+ # note expression is *only* for the immediate verb; not its subverbs
270
+ # c.g. assertion which descends the whole subverb tree
271
+
272
+ # does nothing - override likely
273
+ #def express_or_croak(*a, &b)
274
+ # nil
275
+ #end
276
+
277
+ def express_or_croak(exprArgs=nil, &exprBlok)
278
+ eye = :'DSLSpr::expr'
279
+ eyeTale = to_s
280
+
281
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTale, potrubi_bootstrap_logger_fmt_who(exprArgs: exprArgs, exprBlok: exprBlok))
282
+
283
+ typeVerb = type
284
+
285
+ exprVerb = case typeVerb
286
+ when NilClass then nil
287
+ else
288
+ verbHndl = find_type_handler_or_default_or_croak(typeVerb)
289
+
290
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, 'CALLING VERB HANDLER', potrubi_bootstrap_logger_fmt_who(verbHndl: verbHndl, exprArgs: exprArgs, exprBlok: exprBlok))
291
+
292
+ __send__(verbHndl, exprArgs, &exprBlok)
293
+
294
+ end
295
+
296
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, eyeTale, potrubi_bootstrap_logger_fmt_who(exprVerb: exprVerb, exprArgs: exprArgs, exprBlok: exprBlok))
297
+
298
+ exprVerb
299
+
300
+ end
301
+ alias_method :express, :express_or_croak
302
+
303
+ def find_expression_or_croak(descArgs=nil, &descBlok)
304
+ eye = :'DSLSpr::f_expr'
305
+ exprVerb = (@verb_expression ||= express_or_croak(descArgs, &descBlok))
306
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(exprVerb: exprVerb), potrubi_bootstrap_logger_fmt_who(descArgs: descArgs, descBlok: descBlok))
307
+ exprVerb
308
+ end
309
+
310
+ # produces an array on one k-v pair hashes; one for each subverb
311
+
312
+ def express_subverbs_or_croak(exprArgs=nil, &exprBlok)
313
+ eye = :'DSLCtx::expr_subverbs'
314
+
315
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, to_s, potrubi_bootstrap_logger_fmt_who(subverbs: get_subverbs.size, exprArgs: exprArgs, exprBlok: exprBlok))
316
+
317
+ exprsSubverbs = case
318
+ when has_subverbs? then get_subverbs.map {|c| c.express_or_croak(exprArgs, &exprBlok) }.flatten.compact
319
+ else
320
+ nil
321
+ end
322
+
323
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, to_s, potrubi_bootstrap_logger_fmt_who(exprsSubverbs: exprsSubverbs, exprArgs: exprArgs, exprBlok: exprBlok))
324
+
325
+ exprsSubverbs && potrubi_bootstrap_mustbe_array_or_croak(exprsSubverbs, eye)
326
+
327
+ end
328
+
329
+ def find_subverbs_expressions_or_croak(exprArgs=nil, &exprBlok)
330
+ eye = :'DSLSpr::f_subverbs_expr'
331
+ exprSubverbs = (@subverbs_expression ||= express_subverbs_or_croak(exprArgs, &exprBlok))
332
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(exprSubverbs: exprSubverbs), potrubi_bootstrap_logger_fmt_who(exprArgs: exprArgs, exprBlok: exprBlok))
333
+ exprSubverbs
334
+ end
335
+
336
+ # reduce / merge the individual verb expressions into a single hash
337
+
338
+ def find_subverbs_expression_or_croak(exprArgs=nil, &exprBlok)
339
+ eye = :'DSLSpr::f_subverbs_expr'
340
+ r = express_subverbs_or_croak(exprArgs, &exprBlok)
341
+ exprSubverbs = reduce_verb_expressions_or_croak(*r)
342
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, to_s, potrubi_bootstrap_logger_fmt_who(exprSubverbs: exprSubverbs, exprArgs: exprArgs, exprBlok: exprBlok))
343
+ exprSubverbs
344
+ end
345
+
346
+ # reduce / merge the individual verb expressions into a single hash
347
+ # BUT check for duplicate keys
348
+
349
+ def reduce_verb_expressions_or_croak(*exprVerbs, &exprBlok)
350
+ eye = :'DSLSpr::rdc_verb_exprs'
351
+ exprReduce = potrubi_util_reduce_hashes_or_croak(*exprVerbs) {|k, oldV, newV| potrubi_bootstrap_duplicate_exception(k, eye, "subverb name >#{k} seen twice") }
352
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, to_s, potrubi_bootstrap_logger_fmt_who(exprReduce: exprReduce, exprVerbs: exprVerbs, exprBlok: exprBlok))
353
+ exprReduce && potrubi_bootstrap_mustbe_hash_or_croak(exprReduce)
354
+ end
355
+
356
+
357
+
358
+ # Verb Collections Administration
359
+ # ###############################
360
+
361
+ def has_subverbs?
362
+ ! get_subverbs.empty?
363
+ end
364
+
365
+ def subverbs
366
+ @subverbs ||= []
367
+ end
368
+
369
+ def flatten
370
+ [self, subverbs.map {|c| c.flatten }].flatten.compact
371
+ end
372
+
373
+ def subverbs=(subVerbs)
374
+ @subverbs = potrubi_bootstrap_mustbe_array_or_croak(subVerbs)
375
+ end
376
+
377
+ alias_method :get_subverbs, :subverbs
378
+ alias_method :set_subverbs, :'subverbs='
379
+
380
+ def add_subverbs(*addVerbs)
381
+ eye = :'DSLSpr::a_sub_verbs'
382
+ r = get_subverbs.concat(addVerbs.flatten.compact) # concat updates self
383
+ r = get_subverbs
384
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt(addVerbs: addVerbs), potrubi_bootstrap_logger_fmt(subVerbs: r))
385
+ r
386
+ end
387
+
388
+ def make_and_add_new_verb(*dslArgs, &dslBlok)
389
+ eye = :'DSLSpr::m_and_a_n_verb'
390
+
391
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(dslArgs: dslArgs, dslBlok: dslBlok))
392
+
393
+ dslArgsNrm = potrubi_util_reduce_hashes_or_croak(*dslArgs)
394
+
395
+ newVerb = self.class.new_verb(dslArgsNrm, &dslBlok)
396
+
397
+ add_subverbs(newVerb)
398
+
399
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(newVerb: newVerb, dslArgsNrm: dslArgsNrm, dslArgs: dslArgs, dslBlok: dslBlok))
400
+
401
+ newVerb
402
+
403
+ end
404
+
405
+ def normalise_verb_args_or_croak(verbArgsNom)
406
+ eye = :'DLSSpr::nrm_verb_args'
407
+ verbArgsNrm = case verbArgsNom
408
+ when NilClass then nil
409
+ when Symbol, String then {type: verbArgsNom}
410
+ when Hash then verbArgsNom
411
+ else
412
+ potrubi_bootstrap_surprise_exception(verbArgsNom, eye, "verbArgsNom is what?")
413
+ end
414
+
415
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(verbArgsNrm: verbArgsNrm, verbArgsNomNrm: verbArgsNom))
416
+
417
+ verbArgsNrm
418
+
419
+ end
420
+
421
+ def find_subverb_names
422
+ get_subverbs.map {|c| c.name }
423
+ end
424
+
425
+ def find_subverb_types
426
+ get_subverbs.map {|c| c.type }.uniq
427
+ end
428
+
429
+ # could be overriden
430
+ def find_type_handler_or_croak(verbType, verbTypeHandlers=nil)
431
+ eye = :'DSLSpr::f_type_hndl'
432
+
433
+ vTH = potrubi_bootstrap_mustbe_hash_or_croak(verbTypeHandlers || type_handlers)
434
+
435
+ typeHndl = vTH.has_key?(verbType) ? vTH[verbType] : potrubi_bootstrap_missing_exception(verbType, :f_ctx_hndl, "verbType >#{verbType.class}< >#{verbType}< not known in vTH >#{vTH.class}<")
436
+
437
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(verbType: verbType), potrubi_bootstrap_logger_fmt_who(typeHndl: typeHndl))
438
+
439
+ typeHndl
440
+ end
441
+
442
+ def find_type_handler_or_default_or_croak(typeType)
443
+ begin
444
+ find_type_handler_or_croak(typeType)
445
+ rescue
446
+ find_type_handler_or_croak(:default)
447
+ end
448
+ end
449
+
450
+ def find_subverbs_key_type_or_croak(descArgs=nil, &descBlok)
451
+ eye = :'DSLSpr::f_subctxs_key_type'
452
+
453
+ keyType = case
454
+ when (r = key) then r
455
+ else # find key type from the subverbs
456
+ descSubverbs = find_subverbs_expression_or_croak(descArgs, &descBlok)
457
+ keyTypes = descSubverbs.map {|(k,v)| k.class}.uniq
458
+ if keyTypes.size == 1 then
459
+ keyTypes.first.name.downcase.to_sym
460
+ else
461
+ :any # no consistency
462
+ end
463
+
464
+ end
465
+
466
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(keyType: keyType), potrubi_bootstrap_logger_fmt_who(descArgs: descArgs, descBlok: descBlok))
467
+
468
+ keyType
469
+ end
470
+
471
+
472
+ # Diagnostics
473
+ # ###########
474
+
475
+ def show(*tellTales)
476
+ eye = :show
477
+
478
+ cummulative_tellTale = potrubi_bootstrap_logger_fmt(*tellTales, to_s)
479
+ case
480
+ when has_subverbs? then show_subverbs(cummulative_tellTale)
481
+ else
482
+ potrubi_bootstrap_logger_ms(eye, cummulative_tellTale)
483
+ end
484
+
485
+ self
486
+
487
+ end
488
+
489
+ def show_subverbs(*tellTales)
490
+ has_subverbs? &&
491
+ begin
492
+ cummulative_tellTale = potrubi_bootstrap_logger_fmt(*tellTales)
493
+ get_subverbs.each_with_index {|c, i| c.show(cummulative_tellTale, "index >#{i}<") }
494
+ end
495
+ self
496
+ end
497
+
498
+ def show_verb_expression_or_croak(descVerb, *tellTales)
499
+ eye = :'DSLSpr::show_verb_expr'
500
+ potrubi_bootstrap_mustbe_hash_or_croak(descVerb)
501
+ descVerb.each.with_index {|(k,v), i| potrubi_bootstrap_logger_ca(eye, *tellTales, "index >#{i}<", potrubi_bootstrap_logger_fmt_who(k: k), potrubi_bootstrap_logger_fmt_who(v: v))}
502
+ self
503
+ end
504
+
505
+ end
506
+
507
+ module Potrubi
508
+ class DSL
509
+ class Super
510
+ end
511
+ end
512
+ end
513
+
514
+ Potrubi::DSL::Super.__send__(:include, instanceMethods) # Instance Methods
515
+ Potrubi::DSL::Super.extend(classMethods) # CLass Methods
516
+
517
+ __END__