rubyment 0.7.25694818 → 0.7.25733511

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubyment.rb +228 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c51f1823c3c4dd62e754966ce5baba5868f7b3c7
4
- data.tar.gz: 794b738048de52bb190202abbc345fc100776bcd
3
+ metadata.gz: 0b710e93d0b0389965a9b49b720148c6e365463a
4
+ data.tar.gz: b212104266d18535aaf66e800ea3360017876310
5
5
  SHA512:
6
- metadata.gz: 6c80bd4af0c3c223842b6d4547947e0a53008168f3df7ca1b23ce1a7baeb885f0730644a141802cc68ba393c2e09231dc5046bb96e3759f76b7841c6853c3df4
7
- data.tar.gz: f9617cb107118fc79358e01663e2e63db692e21920380dffa8f55c680f7dc58289884d27c2d068b8440fe92089431785ac0b6b363be7ae1fb286f557d445ae29
6
+ metadata.gz: 6509d00070397420335d4e9e36e99b8a90dc66d9db658e658d8ad947991a47df6843759114fe122ec17f33e7cc20639942640d76475f75a0cfba9f1705aba9a4
7
+ data.tar.gz: 9c7ebeeb1255a241d461c200b51227f9d158cc777a6eede7595d3f0e03b1047374381a4cda9f44f3b4591da611ad3d05e1218ec6ca97feabc69f56ebd0b3a177
data/lib/rubyment.rb CHANGED
@@ -95,6 +95,70 @@ class Object
95
95
  end
96
96
 
97
97
 
98
+ =begin
99
+ # begin_documentation
100
+
101
+ This module offers function to generate ruby code
102
+
103
+ # end_documentation
104
+ =end
105
+ module RubymentRubyCodeGenerationModule
106
+
107
+
108
+ =begin
109
+ if you use vim or a similar editor, you can use such a function as:
110
+ :read !./rubyment.rb invoke_double puts code_ruby_comment_multiline_empty
111
+ =end
112
+ def code_ruby_comment_multiline_empty
113
+ code =<<-ENDHEREDOC
114
+ =begin
115
+ =end
116
+ ENDHEREDOC
117
+ [code]
118
+
119
+ end
120
+
121
+
122
+ =begin
123
+ if you use vim or a similar editor, you can use such a function as:
124
+ :read !./rubyment.rb invoke_double puts code_ruby_module_newmodule_empty
125
+ =end
126
+ def code_ruby_module_newmodule_empty
127
+ code =<<-ENDHEREDOC
128
+ =begin
129
+ # begin_documentation
130
+
131
+ # end_documentation
132
+ =end
133
+ module NewModule
134
+
135
+
136
+ end # of NewModule
137
+
138
+
139
+ ENDHEREDOC
140
+ [code]
141
+
142
+ end
143
+
144
+
145
+ end
146
+
147
+
148
+ =begin
149
+ # begin_documentation
150
+ This module offers function to generate computer languages code
151
+ # end_documentation
152
+ =end
153
+ module RubymentCodeGenerationModule
154
+
155
+
156
+ include RubymentRubyCodeGenerationModule
157
+
158
+
159
+ end
160
+
161
+
98
162
  =begin
99
163
  # begin_documentation
100
164
 
@@ -201,12 +265,91 @@ module RubymentStringsModule
201
265
  end
202
266
 
203
267
 
268
+ =begin
269
+ # begin_documentation
270
+
271
+ This module offers functions to manipulate
272
+ Arrays.
273
+
274
+ # end_documentation
275
+ =end
276
+ module RubymentArraysModule
277
+
278
+
279
+ =begin
280
+ zip will finish with the dimension of
281
+ the first array. It may sound like a feature,
282
+ I guess it is that way because it was the easiest
283
+ thing to implement. This one does the harder thing:
284
+ zip arrays: the generated array will have the
285
+ longest needed dimension.
286
+
287
+ The transpose method of Array suffers from the
288
+ same problem (indeed a bigger one, because it will
289
+ completely refuse to tranpose arrays with different
290
+ dimensions, while it could fill them with nil for us),
291
+ and, again, this function is the solution.
292
+
293
+ returns an #arrays__ definition, which is an array of array
294
+ having a transposition of arrays, which can be interpreted
295
+ as a zip of those arrays.
296
+
297
+ examples:
298
+
299
+ # this case is the same as [1, 2, 3].zip [4, 5]
300
+ arrays__zip [1, 2, 3], [4, 5]
301
+ # => [[1, 4], [2, 5], [3, nil]]
302
+
303
+ # this case is not the same as [1, 2].zip [3, 4, 5]
304
+ arrays__zip [1, 2], [3, 4, 5]
305
+ # => [[1, 3], [2, 4], [nil, 5]]
306
+
307
+
308
+ =end
309
+ def arrays__zip *arrays
310
+ dimension = arrays.map(&:size).max - 1
311
+ (0..dimension).map { |i|
312
+ arrays.map { |a| a[i] }
313
+ }
314
+ end
315
+
316
+
317
+ =begin
318
+
319
+ merge a list of arrays (like applying || on
320
+ each column of the matrix that arrays forms).
321
+
322
+ examples:
323
+ array__merge_shallow [1, false ], [false, 2, 3]
324
+ # => [1, 2, 3]
325
+
326
+ =end
327
+ def array__merge_shallow *arrays
328
+
329
+ arrays__zip(*arrays).map { |a|
330
+ a.reduce "nne"
331
+ }
332
+
333
+ end
334
+
335
+
336
+ end # of RubymentArraysModule
337
+
338
+
204
339
  =begin
205
340
  # begin_documentation
341
+
342
+ CLOSED for extensions: The module InternalRubymentModule
343
+ should have been called RubymentInternalModule instead,
344
+ to preserve the naming standards. RubymentInternalModule
345
+ will receive the new functions, and
346
+ InternalRubymentModule must be closed for extensions.
347
+
206
348
  This module offers function to interface with certain
207
349
  internal structures. Ie, these functions are supposed
208
350
  to be useless unless running Rubyment.
209
351
 
352
+
210
353
  # end_documentation
211
354
  =end
212
355
  module InternalRubymentModule
@@ -260,6 +403,9 @@ module InternalRubymentModule
260
403
 
261
404
  =end
262
405
  def autoreload wtime=1
406
+ (
407
+ sleep wtime
408
+ ) while rubyment_memory__get_key :file_reloading
263
409
  rubyment_memory__set_key :file_reloading, true
264
410
  load rubyment_memory__get_key :filepath
265
411
  rubyment_memory__set_key :file_reloading, false
@@ -269,8 +415,43 @@ module InternalRubymentModule
269
415
  end
270
416
 
271
417
 
418
+ =begin
419
+ # begin_documentation
420
+ This module offers function to interface with certain
421
+ internal structures. Ie, these functions are supposed
422
+ to be useless unless running Rubyment.
423
+
424
+ The module InternalRubymentModule
425
+ should have been called RubymentInternalModule instead,
426
+ to preserve the naming standards. RubymentInternalModule
427
+ will receive the new functions, and
428
+ InternalRubymentModule must be closed for extensions.
429
+
430
+ # end_documentation
431
+ =end
432
+ module RubymentInternalModule
433
+
434
+
435
+ include InternalRubymentModule
436
+
437
+
438
+ end # of InternalRubymentModule
439
+
440
+
272
441
  =begin
273
442
  # begin_documentation
443
+
444
+ CLOSED for extensions:
445
+ The module:
446
+ ModifierForClassObjectModule
447
+ should have been called:
448
+ RubymentModifierForClassObjectModule
449
+ instead, to preserve the naming standards.
450
+ RubymentModifierForClassObjectModule
451
+ will receive the new functions, and
452
+ ModifierForClassObjectModule
453
+ must be closed for extensions.
454
+
274
455
  Object will be changed just by including
275
456
  this file or requiring rubyment, which is not the
276
457
  best approach, but kept to respect the open/closed
@@ -305,6 +486,41 @@ module ModifierForClassObjectModule
305
486
  end
306
487
 
307
488
 
489
+ =begin
490
+ # begin_documentation
491
+
492
+ The module:
493
+ ModifierForClassObjectModule
494
+ should have been called:
495
+ RubymentModifierForClassObjectModule
496
+ instead, to preserve the naming standards.
497
+ RubymentModifierForClassObjectModule
498
+ will receive the new functions, and
499
+ ModifierForClassObjectModule
500
+ must be closed for extensions.
501
+
502
+ Object will be changed just by including
503
+ this file or requiring rubyment, which is not the
504
+ best approach, but kept to respect the open/closed
505
+ principle, the Object class is kept adding some
506
+ methods.
507
+
508
+ However, the best approach is to add new functions
509
+ to this module, which will only be used to modify
510
+ the Object class if the RubymentModule is included.
511
+
512
+
513
+ # end_documentation
514
+ =end
515
+ module RubymentModifierForClassObjectModule
516
+
517
+
518
+ include ModifierForClassObjectModule
519
+
520
+
521
+ end
522
+
523
+
308
524
  =begin
309
525
  # begin_documentation
310
526
  This module receives functions that are being worked on.
@@ -3219,6 +3435,10 @@ end
3219
3435
  - gem package generation and submission.
3220
3436
  - tree parsing.
3221
3437
  - graph visitor.
3438
+ - some advanced patterns, like reloading the implementation of
3439
+ this module from a file without stopping the process (#autoreload).
3440
+ - some function to redesign part of Ruby API arguably misdesigned,
3441
+ like #arrays__zip
3222
3442
 
3223
3443
 
3224
3444
  Rubyment functions must respect the open/closed principle
@@ -3245,12 +3465,18 @@ end
3245
3465
 
3246
3466
  # end_documentation
3247
3467
  =end
3468
+
3469
+ module RubymentDevelopmentModule # must NOT be in master TODO
3470
+ end
3471
+
3248
3472
  module RubymentModule
3249
3473
 
3250
- Object.class_eval { include ModifierForClassObjectModule }
3474
+ Object.class_eval { include RubymentModifierForClassObjectModule }
3475
+ include RubymentCodeGenerationModule
3251
3476
  include RubymentHTMLModule
3252
3477
  include RubymentStringsModule
3253
- include InternalRubymentModule
3478
+ include RubymentArraysModule
3479
+ include RubymentInternalModule
3254
3480
  include RubymentExperimentModule
3255
3481
  include RubymentMaintainedModule
3256
3482
  include RubymentDeprecatedModule
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.25694818
4
+ version: 0.7.25733511
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribamar Santarosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-08 00:00:00.000000000 Z
11
+ date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a gem for keeping Rubyment, a set of ruby helpers
14
14
  email: ribamar@gmail.com