zaphire 0.0.7 → 0.0.8

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zaphire.rb +195 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 961821b2eecc2147a21d33eb3d75ae3493b883f7
4
- data.tar.gz: c11dc0f33fd09dcc6c743a544d730f22a19ef3eb
3
+ metadata.gz: 16c4d8c4e337a2977087cbef6d051b1d74cbe122
4
+ data.tar.gz: 6275d94d423cb8c0e6d8cfb273208ff83aefa2c4
5
5
  SHA512:
6
- metadata.gz: d925b6fbf129ddd0444f0dc6562ac974b5173909905a4d96e5d4c54dc28ce90918f30def4045f5ae2dfeb498f8aecb144e6c7a6a6dcb8728653ad35a1df50d6d
7
- data.tar.gz: 0e54ff0bcb1f9becbf721595618745d9c77cdb43a591d98660126e509a2bdfd97dfd8dbe67480cdb7ebc759e78ff673164804475e23241b61fb168a0deedc87d
6
+ metadata.gz: 38cfa5f33403712a23b1de06139dce987465db7e4bf602e2c2a3e6804833eb57ae8ef3650dbab3bdaa6bfa5c63f92788c1ce3bdd2a2a4c63f42c8876dd7e976c
7
+ data.tar.gz: 9a11fa01b23806f8c3b4e1769dda36f9a2e273fa72cb57cd82a8eb278266961f3faa740e6492141c05d3989fc3dea59199b211d6bb71e8423d747d958ab9e823
@@ -27,6 +27,23 @@ module Zsave
27
27
 
28
28
  end
29
29
 
30
+ # short version for short commands that rely on global variable well set to get things
31
+
32
+ module Z
33
+
34
+ def self.get (pack=@iivar)
35
+
36
+
37
+ key = m(pack,'key')
38
+ sheet = m(pack, 'sheet')
39
+ user = m(pack, 'user')
40
+ password = m(pack, 'password')
41
+ togetx = m(pack, 'x')
42
+ togety = m(pack, 'y')
43
+
44
+
45
+ end
46
+ end
30
47
 
31
48
  module Zgdocs
32
49
 
@@ -170,7 +187,7 @@ def d a
170
187
  puts a
171
188
  end
172
189
 
173
- def m itext,i,xx,iadditional = ""
190
+ def md itext,i,xx,iadditional = ""
174
191
  tt = xx.to_f + 1.00
175
192
  aa = trunc( (( (i.to_f+1) / tt) * 100) )
176
193
  it = itext << ": (" << aa.to_s << "%)"
@@ -229,6 +246,52 @@ def theticks
229
246
  Time.now().to_i
230
247
  end
231
248
 
249
+ # Extending Ruby !!
250
+
251
+ class String
252
+
253
+ def delete_lines(number_of_lines=1)
254
+ split(/\r\n|\r|\n/, number_of_lines+1).last
255
+ end
256
+
257
+ def delete_char(number=1,number2='')
258
+ if number2==''
259
+ self[number-1]=''
260
+ self
261
+ else
262
+ self[number-1..number2-1]=''
263
+ self
264
+ end
265
+ end
266
+
267
+ def char(number=1,number2='')
268
+ if number2==''
269
+ self[number-1]
270
+ else
271
+ self[number-1..number2-1]
272
+ end
273
+ end
274
+
275
+ def line(number=1,number2='')
276
+ if number2==''
277
+ self.split('\n')[number-1]
278
+ else
279
+ self.split('\n')[number-1..number2-1]
280
+ end
281
+ end
282
+
283
+ def contains(tofind)
284
+ self.include? tofind
285
+ end
286
+
287
+ def lastchar(a=1)
288
+ self[-a..-1]
289
+ end
290
+
291
+ def number_of_lines aa
292
+ aa.lines.count
293
+ end
294
+ end
232
295
 
233
296
  class Matrix
234
297
  def dump(firstLine = "")
@@ -274,3 +337,134 @@ end
274
337
  # puts "element [#{xi}, #{yi}] is #{y}"
275
338
  # end
276
339
  # end
340
+
341
+ def offset tofind, pack
342
+ a = pack.index(tofind)
343
+ if a == nill
344
+ a == 0
345
+ else
346
+ a += 1
347
+ end
348
+ return a
349
+ end
350
+
351
+ def length a
352
+ a.length
353
+ end
354
+
355
+ def icrash imessage
356
+ d "CRASH****: " << imessage
357
+ break
358
+ end
359
+
360
+ def m ifld, ipack, icrashnow
361
+ r = "\n"
362
+
363
+ get offset("ı" << ifld << ",",ipack)
364
+ if @it == 0 # multiline pck
365
+ get offset("ı" << ifld << r,ipack)
366
+ ifldend = "ıend" << ifld
367
+ iendc = offset(ifldend, ipack)-2
368
+ if iendc is 0 or iendc <= @it
369
+ if icrashnow == true
370
+ icrash "mExtFrmPck:fldNotFound:'" << ifld << "'"
371
+ return "***CRASH"
372
+ end
373
+ if ipack == ''
374
+ get m(ifld,fiivar(),true)
375
+ else
376
+ get m(ifld,mreformat(ipack),true)
377
+ end
378
+ else
379
+ istart = @it+(ifld.length)+2
380
+ get ipack.char(istart,iendc)
381
+ end
382
+ else
383
+ ifldend = r
384
+ istart = @it+length(ifld)+2
385
+ ilen = length(ipack)
386
+ iendc = offset(ifldend,(ipack.char(istart,ilen)) << r)-2 + istart
387
+ get ipack.char(istart, iendc)
388
+ end
389
+ return @it
390
+ end
391
+
392
+
393
+ def mreformat ipack
394
+ r = "\n"
395
+ istate = ''
396
+
397
+ # str.lines.count
398
+
399
+ while 1 < 2 do
400
+ if ipack.lines.count == 0 then break
401
+ get ipack.lines.first
402
+ ipack = ipack.delete_lines(1)
403
+
404
+ if @it.char(1) == "ı"
405
+ aa = aa << it << r
406
+
407
+ if @it.contains(",") == false
408
+ @it = @it.delete_char(1)
409
+ iend = offset("ıend" << @it,ipack)
410
+ if iend == 0 then icrash "reformat:StartedButNoEnd"
411
+ aa = aa << ipack.char(1,iend)
412
+ ipack = ipack.delete_char(1,iend)
413
+
414
+ aa = aa << ipack.line(1) << r
415
+ ipack = ipack.delete_lines(1)
416
+ end
417
+ next repeat
418
+ else
419
+ aa = aa << "ı" << it << r
420
+ end
421
+ end
422
+
423
+ aa = aa << "≤"
424
+ return aa
425
+
426
+ end
427
+
428
+ def ireplaceachar aa
429
+ a = aa[0]
430
+ b = aa[1]
431
+ aa = aa.delete_char(1,2)
432
+ aa.gsub(a, b)
433
+ end
434
+
435
+ # need to check strange symbols on a Mac, since Window mixes up chars
436
+ def ms iPart,iNewValue,iPack
437
+ r = "\n"
438
+ if ipart == nil then icrash "ms():part not defined"
439
+ if ipack.lastchar() != "≤" then ipack = mreformat(ipack)
440
+ if ipart.contains("≤") then ipart = ireplaceachar("≤Ì" << ipart)
441
+ if iNewValue.contains("≤") then iNewValue = ireplaceachar("≤Ì" << iNewValue)
442
+ if inewvalue.number_of_lines < 2
443
+ iNewPart = "" << iPart << "," << inewvalue
444
+ else
445
+ iNewPart = "" << ipart << r << inewvalue << r << "end" << ipart
446
+ end
447
+ get offset(r << "" << iPart << ",", r << ipack)
448
+ if @it == 0 then get offset(r << "" << iPart << r, r << ipack)
449
+ if @it == 0
450
+ if ipack == ''
451
+ return inewpart << r << "≤"
452
+ else
453
+ ipack[-1] = iNewPart << r << "≤"
454
+ return ipack
455
+ end
456
+ end
457
+ istartchar = it
458
+ iendoffset = offset("end" << ipart << r, ipack << r)
459
+ ilastChar = iendoffset + length(ipart) + 3
460
+ if iendoffset == 0
461
+ yyy = ipack << r
462
+ ilastChar = offset(r, yyy.char(istartchar, (length(ipack)+1))) - 2 + istartchar
463
+ end
464
+ ipack[istartchar-1..ilastchar-1] = iNewPart
465
+ return ipack
466
+ end
467
+
468
+ def fiivar
469
+ @iivar
470
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaphire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lima90001