class Devlog::Day

Attributes

all[RW]

Public Class Methods

new(day, zezzions) click to toggle source
# File lib/devlog.rb, line 340
def initialize(day, zezzions)
  @all = zezzions.sort # sorting by default by zzbegin
  @day = Sevendays::DAYS.include?(day) ? day : Sevendays::RANDOMDAY
end

Public Instance Methods

any?() click to toggle source
# File lib/devlog.rb, line 349
def any?
  all.any?
end
begins_at() click to toggle source
# File lib/devlog.rb, line 353
def begins_at
  return '' unless any?
  all.first.zzbegin.strftime('%H:%M')
end
breaks_at() click to toggle source
# 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() click to toggle source
# File lib/devlog.rb, line 358
def ends_at
  return '' unless any?
  all.last.zzend.strftime("%H:%M")
end
name() click to toggle source
# File lib/devlog.rb, line 345
def name
  @day
end