lib/calrom/config.rb in calrom-0.1.0 vs lib/calrom/config.rb in calrom-0.2.0

- old
+ new

@@ -1,18 +1,32 @@ module Calrom class Config def initialize self.today = Date.today - self.date_range = CR::Util::Month.new(today.year, today.month) + self.date_range = Month.new(today.year, today.month) end - attr_accessor :today, :date_range + attr_accessor :today, :date_range, :formatter, :colours def calendar CR::PerpetualCalendar.new(sanctorale: CR::Data::GENERAL_ROMAN_ENGLISH.load) end def formatter - Formatter::List.new Highlighter::List.new, today + if @formatter == :list || (@formatter.nil? && date_range.is_a?(Day)) + Formatter::List.new highlighter(Highlighter::List), today + elsif @formatter == :easter + Formatter::Easter.new + else + Formatter::Overview.new highlighter(Highlighter::Overview), today + end + end + + def highlighter(colourful) + if self.colours == false + return Highlighter::No.new + end + + colourful.new end end end