Sha256: c6f45ff8fc3f4e9527bc57153e59b7601744a0f9118b803908f8b7aab5fe8946
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module Calrom module Formatter class List < Formatter def call(calendar, date_range) print_months = date_range.first.month != date_range.last.month puts date_range.to_s puts current_month = nil date_range.each do |date| liturgical_day = calendar[date] if print_months && liturgical_day.date.month != current_month current_month = liturgical_day.date.month puts puts liturgical_day.date.strftime('%B') #current_month puts end day liturgical_day end end private def day(liturgical_day) liturgical_day.celebrations.each_with_index do |celebration, i| s = if i > 0 ' ' * 6 else liturgical_day.date.strftime('%a') + liturgical_day.date.day.to_s.rjust(3) end s += ' ' colour = celebration.colour rank = celebration.rank s += highlighter.colour(colour.name[0].upcase, colour) + ' ' + highlighter.rank(celebration.title, rank) + (rank.short_desc.nil? ? '' : ', ' + rank.short_desc) if liturgical_day.date == today s = highlighter.today s end puts s end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
calrom-0.3.0 | lib/calrom/formatter/list.rb |
calrom-0.2.0 | lib/calrom/formatter/list.rb |