Class: Devlog::Day
Instance Attribute Summary collapse
Instance Method Summary
collapse
#total_hours, #total_hours_string
Constructor Details
#initialize(day, zezzions) ⇒ Day
Returns a new instance of Day.
346
347
348
349
|
# File 'lib/devlog.rb', line 346
def initialize(day, zezzions)
@all = zezzions.sort @day = Sevendays::DAYS.include?(day) ? day : Sevendays::RANDOMDAY
end
|
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
343
344
345
|
# File 'lib/devlog.rb', line 343
def all
@all
end
|
Instance Method Details
#any? ⇒ Boolean
355
356
357
|
# File 'lib/devlog.rb', line 355
def any?
all.any?
end
|
#begins_at ⇒ Object
359
360
361
362
|
# File 'lib/devlog.rb', line 359
def begins_at
return '' unless any?
all.first.zzbegin.strftime('%H:%M')
end
|
#breaks_at ⇒ Object
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
# File 'lib/devlog.rb', line 369
def breaks_at
return '' unless any?
size = all.size
return "" if size < 2
breaks = []
first = true
last = nil
all.each do |zezzion|
if first
last = zezzion
first = false
else
breaks << "#{last.zzend.strftime('%H:%M')} -> #{zezzion.zzbegin.strftime('%H:%M')}"
last = zezzion
end
end
breaks.join(', ')
end
|
#ends_at ⇒ Object
364
365
366
367
|
# File 'lib/devlog.rb', line 364
def ends_at
return '' unless any?
all.last.zzend.strftime("%H:%M")
end
|
#name ⇒ Object
351
352
353
|
# File 'lib/devlog.rb', line 351
def name
@day
end
|