Top Level Namespace
Defined Under Namespace
Modules: Z, Zgdocs, Zsave
Classes: Array, Matrix, NilClass, String
Instance Method Summary
collapse
-
#chars(a, b, c = '') ⇒ Object
-
#d(itext, i = nil, xx = '', iadditional = '') ⇒ Object
-
#fiivar(aa = nil) ⇒ Object
rrr = “end”.ok << ipart.ok << r.ok iendoffset = offset(rrr.ok, ipack.ok << r.ok) ilastchar = iendoffset + length(ipart) + 3 if iendoffset == 0 yyy = ipack.ok << r.ok ilastChar = offset(r, yyy.char(istartchar, (length(ipack.ok)+1))) - 2 + istartchar end ipack.ok = inewpart return ipack.ok end.
-
#get(a = '') ⇒ Object
-
#icrash(imessage = '') ⇒ Object
-
#ireplaceachar(aa) ⇒ Object
aa = aa << mend return aa.to_s end.
-
#iSetMsgForTerm(_iterm, _imessage) ⇒ Object
-
#it ⇒ Object
-
#left(a = '', b) ⇒ Object
-
#length(a = '') ⇒ Object
-
#m(ifld = '', ipack = '', icrashnow = '') ⇒ Object
-
#md(ipack) ⇒ Object
-
#ms(ipart = '', inewvalue = '', ipack = '') ⇒ Object
-
#offset(tofind = '', pack = '') ⇒ Object
visiblematrix.each_with_index do |x, xi| x.each_with_index do |y, yi| puts “element [#xi, #yi] is #y” end end.
-
#put(a) ⇒ Object
-
#t ⇒ Object
-
#theticks ⇒ Object
-
#trunc(a, decimals = 0) ⇒ Object
Instance Method Details
#chars(a, b, c = '') ⇒ Object
368
369
370
|
# File 'lib/zaphire.rb', line 368
def chars(a, b, c = '')
c.to_s[a - 1..b - 1]
end
|
#d(itext, i = nil, xx = '', iadditional = '') ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
# File 'lib/zaphire.rb', line 181
def d(itext, i = nil, xx = '', iadditional = '')
if i.nil?
puts itext
return ''
else
iadditional = '' if iadditional.nil?
tt = xx.to_f + 1.00
aa = trunc((( (i.to_f + 1) / tt) * 100))
it = itext << ': (' << aa.to_s << '%)'
return '' if @mvar == it
@mvar = it
texttodisp = @mvar << ' ' << iadditional
i += 1
xx += 1
@mstart = theticks if i == 1
return '' if i == 1 || xx == 1
it = trunc((i.to_f / tt * 10))
ee = ( (theticks.to_f - @mstart.to_f) / 60) * ( (tt - i) / i.to_f)
aa = trunc(ee)
bb = trunc(aa.to_f / 60)
cc1 = aa.to_f / 60
cc2 = trunc((aa.to_f / 60))
cc = trunc((cc1 - cc2) * 60)
cc = '0' << cc.to_s if cc.to_s.size == 1
it = '[' << ' XXXXXXXXXX'[1..it.to_i] << ' __________'[1..(10 - it.to_i)] << '] ' << texttodisp << ' (' << bb.to_s << ':' << cc.to_s << ' Min. left) ' << i.to_i.to_s << ' of ' << tt.to_i.to_s
d it
iSetMsgForTerm(@itermattended, it) unless @itermattended
end
end
|
#fiivar(aa = nil) ⇒ Object
rrr = “end”.ok << ipart.ok << r.ok iendoffset = offset(rrr.ok, ipack.ok << r.ok) ilastchar = iendoffset + length(ipart) + 3 if iendoffset == 0 yyy = ipack.ok << r.ok ilastChar = offset(r, yyy.char(istartchar, (length(ipack.ok)+1))) - 2 + istartchar end ipack.ok = inewpart return ipack.ok end
570
571
572
573
574
|
# File 'lib/zaphire.rb', line 570
def fiivar(aa = nil)
@iivar = '' if @iivar.nil?
@iivar = aa unless aa.nil?
@iivar
end
|
#get(a = '') ⇒ Object
164
165
166
|
# File 'lib/zaphire.rb', line 164
def get(a = '')
@it = a
end
|
#icrash(imessage = '') ⇒ Object
392
393
394
395
|
# File 'lib/zaphire.rb', line 392
def icrash(imessage = '')
d 'CRASH****: ' << imessage
end
|
#ireplaceachar(aa) ⇒ Object
aa = aa << mend return aa.to_s end
486
487
488
489
490
491
492
|
# File 'lib/zaphire.rb', line 486
def ireplaceachar(aa)
a = aa[0]
b = aa[1]
aa = aa.delete_char(1, 2)
aa = aa.gsub(a, b)
aa
end
|
#iSetMsgForTerm(_iterm, _imessage) ⇒ Object
221
222
223
|
# File 'lib/zaphire.rb', line 221
def iSetMsgForTerm(_iterm, _imessage)
''
end
|
#it ⇒ Object
160
161
162
|
# File 'lib/zaphire.rb', line 160
def it
@it
end
|
#left(a = '', b) ⇒ Object
363
364
365
366
|
# File 'lib/zaphire.rb', line 363
def left(a = '', b)
c = b - 1
a.to_s[0..c]
end
|
#length(a = '') ⇒ Object
388
389
390
|
# File 'lib/zaphire.rb', line 388
def length(a = '')
a.length
end
|
#m(ifld = '', ipack = '', icrashnow = '') ⇒ Object
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
|
# File 'lib/zaphire.rb', line 397
def m(ifld = '', ipack = '', icrashnow = '')
return '' if ipack == ''
if ifld == ''
if icrashnow == true
icrash "mExtFrmPck:fldNotFound:'" << ifld << "'"
return '***CRASH'
else
return ''
end
end
a = ipack[ifld]
a = '' if a.nil?
a
end
|
#md(ipack) ⇒ Object
503
504
505
|
# File 'lib/zaphire.rb', line 503
def md(ipack)
ipack.keys.join("\n")
end
|
#ms(ipart = '', inewvalue = '', ipack = '') ⇒ Object
494
495
496
497
498
499
500
501
|
# File 'lib/zaphire.rb', line 494
def ms(ipart = '', inewvalue = '', ipack = '')
ipack = {} if ipack == '' || ipack.nil?
return ipack if ipart == ''
b = {}
b[ipart] = inewvalue
ipack.update(b)
end
|
#offset(tofind = '', pack = '') ⇒ Object
visiblematrix.each_with_index do |x, xi|
x.each_with_index do |y, yi|
puts "element [#{xi}, #{yi}] is #{y}"
end
end
378
379
380
381
382
383
384
385
386
|
# File 'lib/zaphire.rb', line 378
def offset(tofind = '', pack = '')
a = pack.ok.index(tofind)
if a.nil?
a = 0
else
a += 1
end
a
end
|
#put(a) ⇒ Object
177
178
179
|
# File 'lib/zaphire.rb', line 177
def put(a)
puts a.to_s
end
|
#t ⇒ Object
576
577
578
579
580
581
582
|
# File 'lib/zaphire.rb', line 576
def t
a = ''
a = ms('first', 'a', a)
a = ms('second', 'b', a)
m('second', a)
end
|
#theticks ⇒ Object
225
226
227
|
# File 'lib/zaphire.rb', line 225
def theticks
Time.now.to_i
end
|
#trunc(a, decimals = 0) ⇒ Object
168
169
170
171
172
173
174
175
|
# File 'lib/zaphire.rb', line 168
def trunc(a, decimals = 0)
if decimals == 0
a.to_i
else
b = '%.' << decimals << 'f'
sprintf(b, a)
end
end
|