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.
340
341
342
343
|
# File 'lib/devlog.rb', line 340
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.
337
338
339
|
# File 'lib/devlog.rb', line 337
def all
@all
end
|
Instance Method Details
#any? ⇒ Boolean
349
350
351
|
# File 'lib/devlog.rb', line 349
def any?
all.any?
end
|
#begins_at ⇒ Object
353
354
355
356
|
# File 'lib/devlog.rb', line 353
def begins_at
return '' unless any?
all.first.zzbegin.strftime('%H:%M')
end
|
#breaks_at ⇒ Object
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
|
# File 'lib/devlog.rb', line 363
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
358
359
360
361
|
# File 'lib/devlog.rb', line 358
def ends_at
return '' unless any?
all.last.zzend.strftime("%H:%M")
end
|
#name ⇒ Object
345
346
347
|
# File 'lib/devlog.rb', line 345
def name
@day
end
|