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,150 @@
1
+
2
+ # potrubi contract dsl
3
+
4
+ # syntax methods
5
+
6
+ # to ease the creation of new methods using text snippets
7
+
8
+ #require_relative '../../bootstrap'
9
+
10
+ requireList = %w(super ./mixin/new_statements ./mixin/statement_management)
11
+ requireList.each {|r| require_relative "#{r}"}
12
+ ###require "potrubi/klass/syntax/braket"
13
+
14
+
15
+
16
+ instanceMethods = Module.new do
17
+
18
+ include Potrubi::Bootstrap
19
+ ##include Potrubi::Mixin::Util
20
+ include Potrubi::Klass::Syntax::Mixin::NewStatements
21
+ #include Potrubi::Klass::Syntax::Mixin::NameGeneration
22
+ include Potrubi::Klass::Syntax::Mixin::StatementManagement
23
+
24
+ ###attr_accessor :name, :type, :key, :value, :variant, :spec, :edit,
25
+ ###:blok, :key_names, :default
26
+
27
+ attr_accessor :source_name, :target_name
28
+
29
+ def to_s
30
+ syntax
31
+ end
32
+
33
+ def inspect
34
+ @to_inspect ||= potrubi_bootstrap_logger_fmt(potrubi_bootstrap_logger_instance_telltale('DSLSynAli'))
35
+ end
36
+
37
+ # Accessor Methods
38
+ # ################
39
+
40
+ # Name Methods
41
+ # ###########
42
+
43
+ def set_source_name(nameValue)
44
+ self.source_name = nameValue
45
+ self # fluent
46
+ end
47
+
48
+ def set_target_name(nameValue)
49
+ self.target_name = nameValue
50
+ self # fluent
51
+ end
52
+
53
+
54
+ # New to Add Statements Mapping
55
+ # #############################
56
+
57
+ newToAddMap = [
58
+ :method_alias,
59
+ ]
60
+
61
+
62
+ newToAddTexts = newToAddMap.map {|s| "def add_statement_#{s}(*a, &b); add_statements_or_croak(new_statement_#{s}(*a, &b)); end;"}
63
+ ###newToAddTexts << "def add_statement(*a, &b); add_statements_or_croak(new_statement(*a, &b)); end;"
64
+ newToAddText = newToAddTexts.flatten.compact.join("\n")
65
+ puts("ALIAS NEW TO ADD STATEMENT MAP >\n#{newToAddText}")
66
+ module_eval(newToAddText)
67
+
68
+
69
+ # Syntax Methods
70
+ # ##############
71
+
72
+ def syntax
73
+ eye = :'PotKlsSynAli::syn'
74
+ eyeTaleME = '>>>>>>>>>>>>>>>>>> SYN ALI'
75
+ eyeTaleMX = '<<<<<<<<<<<<<<<<<< SYN ALI'
76
+ ###nameMethod = name
77
+
78
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTaleME)
79
+
80
+ aliasStms = statements
81
+
82
+ syntaxAliases = case
83
+ when aliasStms.empty? then nil
84
+ else
85
+
86
+ braketAliases = new_braket_snippet
87
+
88
+ braketAliases.push(###make_syntax_def,
89
+ ###make_syntax_eye,
90
+ ###statements.map {|s| s.syntax },
91
+ aliasStms,
92
+ ###make_syntax_result,
93
+ ###make_syntax_end
94
+
95
+ )
96
+
97
+ braketAliases.to_s
98
+
99
+ end
100
+
101
+ puts("#{eye} SYNTAX ALIAS syntax \n#{syntaxAliases}")
102
+
103
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, eyeTaleMX, potrubi_bootstrap_logger_fmt_who_only(synAli: syntaxAliases))
104
+
105
+ syntaxAliases
106
+ end
107
+
108
+
109
+
110
+
111
+
112
+ end
113
+
114
+ module Potrubi
115
+ class Klass
116
+ module Syntax
117
+ class Alias < Super
118
+ end
119
+ end
120
+ end
121
+ end
122
+
123
+ Potrubi::Klass::Syntax::Alias.__send__(:include, instanceMethods) # Instance Methods
124
+
125
+ __END__
126
+
127
+ Potrubi::Klass::Syntax::Alias.extend(classMethods) # Class Methods
128
+
129
+ __END__
130
+
131
+ m = Potrubi::DSL::Syntax::Method.new_method
132
+
133
+ __END__
134
+
135
+ classMethods = Module.new do
136
+
137
+ def new_contract(dslArgs=nil, &dslBlok) # class method
138
+ eye = :'DSLAcc::KLS new_cxt'
139
+ #potrubi_bootstrap_mustbe_symbol_or_croak(dslAttr, eye, "dslAttr is what?")
140
+ newContract = self.new(dslArgs, &dslBlok)
141
+ #$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(newContract: newContract), potrubi_bootstrap_logger_fmt_who(dslAttr: dslAttr, dslArgs: dslArgsNrm, dslBlok: dslBlok))
142
+ newContract
143
+ ###STOPHERENEWCONTRACTEXIT
144
+ end
145
+ end
146
+
147
+ Potrubi::Mixin::Contract::DSL.extend(classMethods) # CLass Methods
148
+
149
+ __END__
150
+
@@ -8,35 +8,105 @@ defined?($DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET) ||
8
8
  $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET ||= nil
9
9
  end
10
10
 
11
- require "potrubi/core"
12
- require 'potrubi/mixin/dynamic-recipes'
11
+ #require "potrubi/core"
12
+ #require 'potrubi/mixin/dynamic-recipes'
13
13
 
14
- klassContent = Class.new do
14
+ requireList = %w(../../bootstrap ../../mixin/dynamic-recipes)
15
+ requireList.each {|r| require_relative "#{r}"}
15
16
 
16
- include Potrubi::Core
17
+
18
+ klassMethods = Module.new do
19
+
20
+ include Potrubi::Bootstrap
17
21
  ###include Potrubi::Mixin::DynamicRecipes
18
22
 
19
23
  # Class Methods
20
24
  # #############
21
25
 
22
- def self.new_method
26
+ def new_method
23
27
  new(:pos_text => "\n")
28
+ #new
24
29
  end
25
30
 
26
- def self.new_stanza
31
+ def new_snippet
27
32
  new(:pos_text => "\n")
33
+ ###new
28
34
  end
29
35
 
30
- def self.new_statement
36
+ def new_statement
37
+ #puts("BRAKET NEW STATEMENT")
31
38
  #self.new(nil, nil)
32
39
  new
33
40
  end
34
41
 
42
+ end
43
+
44
+ instanceMethods = Module.new do
45
+
46
+ include Potrubi::Bootstrap
47
+
35
48
  attr_accessor :pre_text, :pos_text
36
49
 
50
+ def inspect
51
+ @to_inspect ||= potrubi_bootstrap_logger_fmt(potrubi_bootstrap_logger_instance_telltale('KlsSynBkt'))
52
+ end
53
+
37
54
  def initialize(initArgs=nil)
38
- initArgs && mustbe_hash_or_croak(initArgs, :'braket i').each {|k,v| self.__send__("#{k}=", v)}
55
+ initArgs && potrubi_bootstrap_mustbe_hash_or_croak(initArgs, :'braket i').each {|k,v| self.__send__("#{k}=", v)}
56
+ end
57
+
58
+ def zzzto_ary
59
+ self
39
60
  end
61
+
62
+ def west_midl_east
63
+ [
64
+ defined?(@west) ? @west : nil,
65
+ defined?(@midl) ? @midl : nil,
66
+ defined?(@east) ? @east : nil
67
+ ]
68
+ end
69
+ alias_method :to_a, :west_midl_east
70
+ ###alias_method :to_ary, :west_midl_east
71
+
72
+ def zzzflatten
73
+ to_a.inject([]) {|s,a| a ? s.concat(a.flatten) : s}
74
+ end
75
+
76
+ def empty?
77
+ to_a.inject(true) {|s,a| a ? (s && a.empty?) : s}
78
+ end
79
+
80
+ def clear
81
+ to_a.each {|a| a && a.clear }
82
+ end
83
+
84
+
85
+
86
+
87
+ def zzzflatten
88
+ result = []
89
+ defined&&(@west) && result.concat(@west.flatten)
90
+ defined&&(@midl) && result.concat(@midl.flatten)
91
+ defined&&(@east) && result.concat(@east.flatten)
92
+ result
93
+ end
94
+
95
+
96
+ def zzzempty?
97
+ p = defined?(@west) ? @west.empty? : true
98
+ q = defined?(@midl) ? @midl.empty? : true
99
+ r = defined?(@east) ? @east.empty? : true
100
+ (p && q && r) ? true : false
101
+ end
102
+
103
+ def zzzclear
104
+ defined?(@west) && @west.clear
105
+ defined?(@midl) && @midl.clear
106
+ defined?(@east) && @east.clear
107
+ self
108
+ end
109
+ alias_method :reset, :clear
40
110
 
41
111
  def to_s
42
112
  eye = :'bkt to_s'
@@ -44,12 +114,12 @@ klassContent = Class.new do
44
114
  posText = pos_text
45
115
 
46
116
  fullText = [
47
- defined?(@head) && head_text(preText, posText),
117
+ defined?(@west) && west_text(preText, posText),
48
118
  defined?(@midl) && midl_text(preText, posText),
49
- defined?(@tail) && tail_text(preText, posText),
119
+ defined?(@east) && east_text(preText, posText),
50
120
  ].flatten.compact.join
51
121
 
52
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && logger_ca(eye, "self >#{self.object_id}< fulText >#{fullText.class}< >\n#{fullText}\n< ")
122
+ $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && potrubi_bootstrap_logger_ca(eye, "self >#{self.object_id}< fulText >#{fullText.class}< >\n#{fullText}\n< ")
53
123
 
54
124
  fullText
55
125
 
@@ -61,11 +131,11 @@ klassContent = Class.new do
61
131
  fulText = to_s
62
132
  edtText = case editList
63
133
  when NilClass then fulText
64
- when Hash, Array then Potrubi::Core.dynamic_apply_edits(editList, fullText)
134
+ when Hash, Array then Potrubi::Core.dynamic_apply_edits(editList, fulText)
65
135
  else
66
- surprise_exception(editList, eye, "editList >#{editList.whoami_debug}< is what?")
136
+ potrubi_bootstrap_surprise_exception(editList, eye, "editList >#{editList.whoami_debug}< is what?")
67
137
  end
68
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && logger_ca(eye, "self >#{self.object_id} edtText >\n#{edtText}\n<")
138
+ $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && potrubi_bootstrap_logger_ca(eye, "self >#{self.object_id} edtText >\n#{edtText}\n<")
69
139
  edtText
70
140
  end
71
141
 
@@ -74,7 +144,7 @@ klassContent = Class.new do
74
144
  textMethodText =
75
145
  'def METHOD_NAME_text(preText=nil, posText=nil)
76
146
  METHOD_NAMEText = defined?(@METHOD_NAME) ? (@METHOD_NAME.map {|i| [preText, i.to_s, posText]}.flatten.compact.join) : nil
77
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && logger_ca(:METHOD_NAME_text, "self >#{self.object_id}< METHOD_NAMEText >#{METHOD_NAMEText.class}< >#{METHOD_NAMEText}<")
147
+ $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && potrubi_bootstrap_logger_ca(:METHOD_NAME_text, "self >#{self.object_id}< METHOD_NAMEText >#{METHOD_NAMEText.class}< >#{METHOD_NAMEText}<")
78
148
  METHOD_NAMEText
79
149
  end'
80
150
 
@@ -92,25 +162,25 @@ klassContent = Class.new do
92
162
  alias_method :cons_METHOD_NAME, :unshift_METHOD_NAME
93
163
  def pop_METHOD_NAME
94
164
  r = defined?(@METHOD_NAME) ? @METHOD_NAME.pop : nil
95
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && logger_ca(:pop_METHOD_NAME, "self >#{self.object_id}< r >#{r}<")
165
+ $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && potrubi_bootstrap_logger_ca(:pop_METHOD_NAME, "self >#{self.object_id}< r >#{r}<")
96
166
  r
97
167
  end
98
168
  def shift_METHOD_NAME
99
169
  r = defined?(@METHOD_NAME) ? @METHOD_NAME.shift : nil
100
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && logger_ca(:shift_METHOD_NAME, "self >#{self.object_id}< r >#{r}<")
170
+ $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET && potrubi_bootstrap_logger_ca(:shift_METHOD_NAME, "self >#{self.object_id}< r >#{r}<")
101
171
  r
102
172
  end'
103
173
 
104
174
  defTextList = [textMethodText, baseMethodText]
105
- ###puts("TEXT TEST TEXT >#{defTextList}<")
175
+ #puts("TEXT TEST TEXT >#{defTextList}<")
106
176
 
107
177
  braketMethods = {
108
- :tail => defTextList,
109
- :head => defTextList,
178
+ :east => defTextList,
179
+ :west => defTextList,
110
180
  :midl => defTextList,
111
181
  }
112
182
 
113
- Potrubi::Core.dynamic_define_methods(self, braketMethods) do |k, v|
183
+ Potrubi::Mixin::Dynamic.dynamic_define_methods(self, braketMethods) do |k, v|
114
184
  edits = {
115
185
  ARGS_SPEC: 'args.flatten(1)',
116
186
  METHOD_NAME: k,
@@ -129,8 +199,13 @@ klassContent = Class.new do
129
199
  :unshift => :unshift_midl,
130
200
  :cons => :cons_midl,
131
201
  :tail => :tail_midl,
202
+
203
+ :cons_head => :cons_west,
204
+ :push_tail => :tail_east,
205
+
132
206
  }
133
207
 
208
+ ###$DEBUG_POTRUBI_BOOTSTRAP = true
134
209
  #Potrubi::Core.dynamic_define_methods_aliases(self, aliasMethods)
135
210
  Potrubi::Mixin::DynamicRecipes.recipe_aliases(self, aliasMethods)
136
211
 
@@ -141,7 +216,7 @@ klassContent = Class.new do
141
216
  def raw_debug(levelText=nil)
142
217
  eye = :'braket r_dbg'
143
218
 
144
- $DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET &&
219
+ #$DEBUG_POTRUBI_KLASS_SYNTAX_BRAKET &&
145
220
  begin
146
221
  levelString = case levelText
147
222
  when NilClass then 'BRAKET'
@@ -154,9 +229,9 @@ klassContent = Class.new do
154
229
 
155
230
  puts "#{levelString} #{braketAddress} ==>"
156
231
 
157
- defined?(@head) && raw_content_debug(levelString, "head", @head)
232
+ defined?(@west) && raw_content_debug(levelString, "west", @west)
158
233
  defined?(@midl) && raw_content_debug(levelString, "midl", @midl)
159
- defined?(@tail) && raw_content_debug(levelString, "tail", @tail)
234
+ defined?(@east) && raw_content_debug(levelString, "east", @east)
160
235
 
161
236
  puts "#{levelString} #{braketAddress} <=="
162
237
  end
@@ -181,7 +256,7 @@ klassContent = Class.new do
181
256
  end
182
257
  end
183
258
  else
184
- surprise_exception(contentData, eye)
259
+ potrubi_bootstrap_surprise_exception(contentData, eye)
185
260
  end
186
261
 
187
262
  self
@@ -190,6 +265,21 @@ klassContent = Class.new do
190
265
 
191
266
  end
192
267
 
268
+ module Potrubi
269
+ class Klass
270
+ module Syntax
271
+ class Braket
272
+ end
273
+ end
274
+ end
275
+ end
276
+
277
+ Potrubi::Klass::Syntax::Braket.__send__(:include, instanceMethods) # Instance Methods
278
+ Potrubi::Klass::Syntax::Braket.extend(klassMethods) # Class Methods
279
+
280
+
281
+ __END__
282
+
193
283
  #Potrubi::Core.assign_class_constant_or_croak(klassContent, __FILE__)
194
284
  Potrubi::Core.assign_class_constant_or_croak(klassContent, :Potrubi, :Klass, :Syntax, :Braket)
195
285
 
@@ -0,0 +1,45 @@
1
+
2
+ # potrubi contract dsl
3
+
4
+ # syntax method: builder
5
+
6
+ # to ease the creation of new methods using text manipulation
7
+
8
+ require_relative '../../bootstrap'
9
+
10
+ requireList = %w(super ./mixin/new_snippets)
11
+ requireList.each {|r| require_relative "#{r}"}
12
+ ###require "potrubi/klass/syntax/braket"
13
+
14
+ classMethods = Module.new do
15
+
16
+ include Potrubi::Bootstrap
17
+ include Potrubi::Klass::Syntax::Mixin::NewSnippets
18
+ include Potrubi::Klass::Syntax::Mixin::NewMethods
19
+ include Potrubi::Klass::Syntax::Mixin::NewAliases
20
+ include Potrubi::Klass::Syntax::Mixin::NameGeneration
21
+ end
22
+
23
+ instanceMethods = Module.new do
24
+
25
+ include Potrubi::Klass::Syntax::Mixin::NewSnippets
26
+ include Potrubi::Klass::Syntax::Mixin::NewMethods
27
+ include Potrubi::Klass::Syntax::Mixin::NewAliases
28
+ include Potrubi::Klass::Syntax::Mixin::SynelManagement
29
+
30
+ end
31
+
32
+ module Potrubi
33
+ class Klass
34
+ module Syntax
35
+ class Builder
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ Potrubi::Klass::Syntax::Builder.__send__(:include, instanceMethods) # Instance Methods
42
+ Potrubi::Klass::Syntax::Builder.extend(classMethods) # Class Methods
43
+
44
+ __END__
45
+
@@ -0,0 +1,436 @@
1
+
2
+ # potrubi contract dsl
3
+
4
+ # syntax methods
5
+
6
+ # to ease the creation of new methods using text snippets
7
+
8
+ #require_relative '../../bootstrap'
9
+
10
+ requireList = %w(super ./mixin/new_statements ./mixin/name_generation ./mixin/synel_management)
11
+ #requireList = %w(super)
12
+ defined?(requireList) && requireList.each {|r| require_relative "#{r}"}
13
+
14
+ #__END__
15
+
16
+ classMethods = Module.new do
17
+
18
+ include Potrubi::Bootstrap
19
+
20
+ # let the class be able to call new_method
21
+ include Potrubi::Klass::Syntax::Mixin::NewMethods
22
+
23
+ end
24
+
25
+ instanceMethods = Module.new do
26
+
27
+ include Potrubi::Bootstrap
28
+ ##include Potrubi::Mixin::Util
29
+ include Potrubi::Klass::Syntax::Mixin::NewSnippets
30
+ include Potrubi::Klass::Syntax::Mixin::NewStatements
31
+ include Potrubi::Klass::Syntax::Mixin::NameGeneration
32
+ #include Potrubi::Klass::Syntax::Mixin::StatementManagement
33
+ include Potrubi::Klass::Syntax::Mixin::SynelManagement
34
+
35
+ ###attr_accessor :name, :type, :key, :value, :variant, :spec, :edit,
36
+ ###:blok, :key_names, :default
37
+
38
+ attr_accessor :name, :eye, :signature, :result
39
+
40
+ def to_s
41
+ syntax
42
+ end
43
+
44
+ def inspect
45
+ ###potrubi_bootstrap_logger_fmt(potrubi_bootstrap_logger_instance_telltale('DSLSynMth'), potrubi_bootstrap_logger_fmt(n: name))
46
+ @to_inspect ||= potrubi_bootstrap_logger_fmt(potrubi_bootstrap_logger_instance_telltale('DSLSynMth'))
47
+ end
48
+
49
+ # Accessor Methods
50
+ # ################
51
+
52
+ #alias_method :set_name, :'name='
53
+ #alias_method :set_eye, :'eye='
54
+ #alias_method :set_signature, :'signature='
55
+ alias_method :get_signature, :'signature'
56
+ #alias_method :set_result, :'result='
57
+ alias_method :get_result, :'result'
58
+
59
+ # Iterator Methods
60
+ # ################
61
+
62
+ def iterator_block(iterName, *iterArgs, &iterBlok)
63
+ eye = :'PotKlsSynMth::iter_blok'
64
+ eyeTale = 'ITER BLOK'
65
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTale, potrubi_bootstrap_logger_fmt_who_only(iterName: iterName, iterArgs: iterArgs, iterBlok: iterBlok))
66
+
67
+ #snipInst = new_snippet(parent: parent, delegate: delegate)
68
+ snipInst = new_snippet(parent: parent, delegate: self)
69
+
70
+ ##iterSource = potrubi_bootstrap_mustbe_symbol_or_croak(iterArgs.shift, eye)
71
+
72
+ #$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, 'ITER SNIP', potrubi_bootstrap_logger_fmt_who(iterName: iterName, iterSource: iterSource, snipInst: snipInst))
73
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, 'ITER SNIP', potrubi_bootstrap_logger_fmt_who(iterName: iterName, snipInst: snipInst))
74
+
75
+ iterNewStmMethod = "new_statement_iterator_#{iterName}"
76
+
77
+
78
+ #iterEachStm = __send__(iterNewStmMethod, iterSource, *iterArgs, &iterBlok)
79
+ iterEachStm = __send__(iterNewStmMethod, iterName, *iterArgs, &iterBlok)
80
+
81
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, 'ITER SNIP EACH', potrubi_bootstrap_logger_fmt_who(iterName: iterName, iterEachStm: iterEachStm, snipInst: snipInst))
82
+
83
+ #STOPHEREITERX1
84
+
85
+ Kernel.block_given? && snipInst.instance_eval(&iterBlok)
86
+
87
+ snipInst.cons_west_synels(iterEachStm)
88
+ snipInst.tail_east_synels(new_statement_end) # add end of block
89
+
90
+ #SYOPHEREITERBLOKX1
91
+
92
+ puts("##{eye} #{eyeTale} SYN SYN SYN >>>>>>>>>>>>>>>>>>> >\n#{snipInst.syntax}<")
93
+
94
+ #SYOPHEREITERBLOKX2
95
+
96
+ add_synels_or_croak(snipInst) # now add to the method
97
+
98
+ #SYOPHEREITERBLOKX3
99
+
100
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(snipInst: snipInst), potrubi_bootstrap_logger_fmt_who_only(iterArgs: iterArgs, iterBlok: iterBlok))
101
+ self # fluent
102
+ #SYOPHEREITERBLOKEXIT
103
+ end
104
+
105
+
106
+
107
+
108
+ # Name Methods
109
+ # ###########
110
+
111
+ def set_name(*nameValues)
112
+ self.name = name_builder_method(*nameValues)
113
+ self # fluent
114
+ end
115
+
116
+ # Eye Methods
117
+ # ###########
118
+
119
+ def set_eye(*eyeValues)
120
+ self.eye = name_builder_eye(*eyeValues)
121
+ self # fluent
122
+ end
123
+
124
+ # Result Methods
125
+ # ##############
126
+
127
+ def set_result(resultValue)
128
+ self.result = resultValue
129
+ self # fluent
130
+ end
131
+
132
+ def set_result_self
133
+ set_result('self')
134
+ end
135
+
136
+ # Signature Methods
137
+ # #################
138
+
139
+ def set_signature(*signatures)
140
+ self.signature = signatures.flatten.compact.join(',')
141
+ self # fluent
142
+ end
143
+
144
+ def set_signature_values_and_blok(*names)
145
+ sigKey = name_creator('', *names)
146
+ set_signature("*#{sigKey}Values", "&#{sigKey}Blok")
147
+ end
148
+ alias_method :set_signature_values_and_block, :set_signature_values_and_blok
149
+
150
+ def set_signature_generic
151
+ set_signature('*a', '&b')
152
+ end
153
+
154
+ def set_signature_args_and_blok(*names)
155
+ sigKey = name_creator('', *names)
156
+ set_signature("#{sigKey}Args=nil", "&#{sigKey}Blok")
157
+ end
158
+ alias_method :set_signature_args_and_block, :set_signature_args_and_blok
159
+
160
+ # # Snippet Methods
161
+ # # ###############
162
+
163
+ # def new_snippets(*snippets, &snipBlok)
164
+ # snippets.map {|s| new_statement(s) }
165
+ # end
166
+
167
+ # def new_snippet(*snips, &snipBlok)
168
+ # new_statement(*snips)
169
+ # end
170
+
171
+ # # New to Add Snippets Mapping
172
+ # # ###########################
173
+
174
+ # newToAddMap = [:snippet,
175
+ # :snippets,
176
+ # ]
177
+
178
+
179
+ # newToAddTexts = newToAddMap.map {|s| "def add_#{s}(*a, &b); add_statements_or_croak(new_#{s}(*a, &b)); end;"}
180
+ # ###newToAddTexts << "def add_snippet(*a, &b); add_statements_or_croak(new_snippet(*a, &b)); end;"
181
+ # newToAddText = newToAddTexts.flatten.compact.join("\n")
182
+ # puts("NEW TO ADD SNIPPET MAP >\n#{newToAddText}")
183
+ # module_eval(newToAddText)
184
+ # #STOPHEREADDTONEWSNIPPETMETHODS
185
+
186
+
187
+
188
+ # New to Add Statements Mapping
189
+ # #############################
190
+
191
+ newToAddMap = [
192
+ :logger_method_entry,
193
+ :logger_method_exit,
194
+ :logger_method_call,
195
+ :logger_call,
196
+ :logger_method_entry,
197
+ :assign,
198
+ :assign_if_not_set,
199
+ :assign_instance_variable,
200
+ :assign_instance_variable_if_not_set,
201
+ :assign_local_variable,
202
+ :method_call,
203
+ ###:snippets,
204
+ :in_parentheses,
205
+ :if_ternary,
206
+ :end,
207
+ :self,
208
+ :rescue,
209
+ :rescue_nil,
210
+ :surprise_exception,
211
+ :missing_exception,
212
+ :duplicate_exception,
213
+ :predicate_and_exception,
214
+ :predicate_and_surprise_exception,
215
+ :predicate_and_duplicate_exception,
216
+ :predicate_and_missing_exception,
217
+ :contracts,
218
+ ]
219
+
220
+
221
+ newToAddTexts = newToAddMap.map {|s| "def add_statement_#{s}(*a, &b); add_synels_or_croak(new_statement_#{s}(*a, &b)); end;"}
222
+ newToAddTexts << "def add_statement(*a, &b); add_synels_or_croak(new_statement(*a, &b)); end;"
223
+ newToAddTexts << "def add_statements(*a, &b); add_synels_or_croak(new_statements(*a, &b)); end;"
224
+ newToAddText = newToAddTexts.flatten.compact.join("\n")
225
+ puts("NEW TO ADD STATEMENT MAP >\n#{newToAddText}")
226
+ module_eval(newToAddText)
227
+
228
+ #STOPHEREPOSTNEWTOADDMAP
229
+
230
+ # Syntax Methods
231
+ # ##############
232
+
233
+ def syntax
234
+ eye = :'PotKlsSynMth::syn'
235
+ eyeTaleME = '>>>>>>>>>>>>>>>>>> SYN MTH'
236
+ eyeTaleMX = '<<<<<<<<<<<<<<<<<< SYN MTH'
237
+ nameMethod = name
238
+
239
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTaleME, potrubi_bootstrap_logger_fmt_who_only(nameMethod: nameMethod))
240
+
241
+ syntaxMethod = case nameMethod
242
+ when NilClass then nil
243
+ else
244
+
245
+ braketMethod = new_braket_method
246
+
247
+ braketMethod.push(make_syntax_def,
248
+ make_syntax_eye,
249
+ ###statements.map {|s| s.syntax },
250
+ ###statements,
251
+ synels,
252
+ make_syntax_result,
253
+ make_syntax_end
254
+
255
+ )
256
+
257
+ #braketMethod.to_s
258
+ braketMethod.to_s.gsub(/\n+/, "\n")
259
+
260
+ end
261
+
262
+ puts("#{eye} SYNTAX METHOD NAME >#{nameMethod}< syntax \n#{syntaxMethod}")
263
+
264
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, eyeTaleMX, potrubi_bootstrap_logger_fmt_who_only(nameMethod: nameMethod, synMth: syntaxMethod))
265
+
266
+ #STOPHEREMETHODSYNTAXEXIT
267
+
268
+ syntaxMethod
269
+ end
270
+
271
+ def make_syntax_def
272
+ #eye = :'PotKlsSynMth::m_syn_def'
273
+ nameMethod = name
274
+ syntaxSignature = make_syntax_signature
275
+ new_statement('def ', nameMethod, syntaxSignature)
276
+ end
277
+
278
+ def make_syntax_signature
279
+ #eye = :'PotKlsSynMth::m_syn_sig'
280
+ signatureMethod = signature
281
+ case signatureMethod
282
+ when NilClass then nil
283
+ else
284
+ new_statement_in_parentheses(signatureMethod)
285
+ end
286
+ end
287
+
288
+ def make_syntax_end
289
+ :end
290
+ end
291
+
292
+ def make_syntax_eye
293
+ eyeLocal = eye
294
+ eyeLocal ? new_statement("eye = :'", eyeLocal, "'") : nil
295
+ end
296
+
297
+ def make_syntax_result
298
+ resultLocal = result
299
+ #resultLocal ? new_statement(resultLocal) : new_statement_self
300
+ resultLocal ? new_statement(resultLocal) : nil
301
+ end
302
+
303
+
304
+
305
+
306
+ end
307
+
308
+ module Potrubi
309
+ class Klass
310
+ module Syntax
311
+ class Method < Potrubi::Klass::Syntax::Super
312
+ end
313
+ end
314
+ end
315
+ end
316
+
317
+ Potrubi::Klass::Syntax::Method.__send__(:include, instanceMethods) # Instance Methods
318
+ Potrubi::Klass::Syntax::Method.extend(classMethods) # Class Methods
319
+
320
+ __END__
321
+
322
+ m = Potrubi::DSL::Syntax::Method.new_method
323
+
324
+ __END__
325
+
326
+ classMethods = Module.new do
327
+
328
+ def new_contract(dslArgs=nil, &dslBlok) # class method
329
+ eye = :'DSLAcc::KLS new_cxt'
330
+ #potrubi_bootstrap_mustbe_symbol_or_croak(dslAttr, eye, "dslAttr is what?")
331
+ newContract = self.new(dslArgs, &dslBlok)
332
+ #$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(newContract: newContract), potrubi_bootstrap_logger_fmt_who(dslAttr: dslAttr, dslArgs: dslArgsNrm, dslBlok: dslBlok))
333
+ newContract
334
+ ###STOPHERENEWCONTRACTEXIT
335
+ end
336
+ end
337
+
338
+ Potrubi::Mixin::Contract::DSL.extend(classMethods) # CLass Methods
339
+
340
+ __END__
341
+
342
+ def new_method(*a, &b)
343
+ self.class.new_method(*a, &b)
344
+ end
345
+
346
+ def new_statement(*a)
347
+ puts("METHOD NEW STATEMNET")
348
+ bktStm = new_braket_statement
349
+ a.empty? || bktStm.push(*a)
350
+ ##:wouldbeanewstat
351
+ bktStm
352
+ end
353
+
354
+
355
+ def new_method(dslArgs=nil, &dslBlok) # class method
356
+ eye = :'PotKlsSynMth::n'
357
+ puts("NEW METHOD")
358
+ #potrubi_bootstrap_mustbe_symbol_or_croak(dslAttr, eye, "dslAttr is what?")
359
+ newMethod = new(dslArgs, &dslBlok)
360
+ #$DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ca(eye, potrubi_bootstrap_logger_fmt_who(newMethod: newMethod), potrubi_bootstrap_logger_fmt_who(dslAttr: dslAttr, dslArgs: dslArgsNrm, dslBlok: dslBlok))
361
+ newMethod
362
+ ###STOPHERENEWMETHODEXIT
363
+ end
364
+
365
+ def zzzadd_statement(*statementElements)
366
+ eye = :'PotKlsSynMth::a_stm'
367
+
368
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, potrubi_bootstrap_logger_fmt_who(statementElements: statementElements))
369
+
370
+ newStatement = new_statement(statementElements)
371
+
372
+ add_statements_or_croak(newStatement)
373
+
374
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who_only(newStatement: newStatement, statementElements: statementElements))
375
+
376
+ self # allows for "fluent interface"
377
+
378
+ end
379
+
380
+
381
+ def zzzziterator_block_each(*iterArgs, &iterBlok)
382
+ eye = :'iter_blok'
383
+ eyeTale = 'ITER BLOK'
384
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_me(eye, eyeTale, potrubi_bootstrap_logger_fmt_who_only(iterArgs: iterArgs, iterBlok: iterBlok))
385
+
386
+ #snipInst = new_snippet(parent: parent, delegate: delegate)
387
+ snipInst = new_snippet(parent: parent)
388
+
389
+
390
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_ms(eye, eyeTale, 'SNIP INST', potrubi_bootstrap_logger_fmt_who(snipInst: snipInst))
391
+
392
+ iterMethod = potrubi_bootstrap_mustbe_symbol_or_croak(iterArgs[0], eye)
393
+ iterSource = potrubi_bootstrap_mustbe_symbol_or_croak(iterArgs[1], eye)
394
+
395
+ iterStm = case iterMethod
396
+ when :each, :map, :each_with_hash, :each_with_array then
397
+
398
+ blokArgs = iterArgs[2 ... iterArgs.size].join(',')
399
+
400
+ iterMethodArgs = case iterMethod
401
+ when :each_with_hash then '{}'
402
+ when :each_with_array then '[]'
403
+ else
404
+ nil
405
+ end
406
+
407
+
408
+ new_statement(iterSource,
409
+ '.',
410
+ iterMethod,
411
+ iterMethodArgs && "(#{iterMethodArgs})",
412
+ ' do | ',
413
+ blokArgs,
414
+ ' |',
415
+ )
416
+
417
+
418
+ else
419
+ potrubi_bootstrap_surprise_excepton(iterMethod, eye, "iterMethod is what?")
420
+ end
421
+
422
+
423
+ snipInst.cons_west_synels(iterStm)
424
+ snipInst.tail_east_synels(new_statement_end) # add end of block
425
+
426
+ #SYOPHEREITERBLOKENTR
427
+
428
+
429
+ puts("##{eye} #{eyeTale} SYN >\n#{snipInst.syntax}<")
430
+
431
+ add_synels_or_croak(snipInst) # now add to the method
432
+
433
+ $DEBUG_POTRUBI_BOOTSTRAP && potrubi_bootstrap_logger_mx(eye, potrubi_bootstrap_logger_fmt_who(snipInst: snipInst), potrubi_bootstrap_logger_fmt_who_only(iterArgs: iterArgs, iterBlok: iterBlok))
434
+ self # fluent
435
+ # SYOPHEREITERBLOKEXIT
436
+ end