Sha256: 234bfa260a9a9bafc581ac2e7cf8c5e840376f2c0b974e28e0977dc7621eb1c6
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Calrom module Formatter class Condensed < Formatter def call(calendar, date_range) calendar.each_day_in_range(date_range) {|d| day d } end private def day(liturgical_day) c = liturgical_day.celebrations.first colour = highlighter.colour(c.colour.name[0].upcase, c.colour) rank = highlighter.rank(rank(c.rank), c.rank) title = short_title c more = additional_celebrations(liturgical_day) + vespers(liturgical_day) puts "#{title} #{rank}#{colour}#{more}" end def rank(rank) if rank.solemnity? '*' elsif rank.feast? '+' else '' end end def short_title(celebration) if celebration.cycle == :sanctorale # naive attempt to strip feast titles celebration.title.sub /,[^,]*$/, '' else celebration.title end end def additional_celebrations(day) size = day.celebrations.size size > 1 ? " +#{size-1}" : '' end def vespers(day) day.vespers_from_following? ? '>' : '' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
calrom-0.4.0 | lib/calrom/formatter/condensed.rb |