lib/vscal/special_dates.rb
def hilight_days_from_config_file
      hilights = []

      return hilights unless File.exist?(CONFIG_FILE)

      File.readlines(CONFIG_FILE).each do |line|
        next if line !~ /^\d{1,2}\s\d{1,2}(\s\d{1,4})?.*$/
        day, month, year = line.split(' ').map(&:to_i)
        year = @year if year.nil?
        date = Date.new(year, month, day) rescue next  # protect from malformed config
        hilights << date
      end

      hilights
    end
# read and parse dates from the configuration file
read and parse dates from the configuration file
read and parse dates from the configuration file
def hilight_days_from_config_file
      hilights = []
      return hilights unless File.exist?(CONFIG_FILE)
      File.readlines(CONFIG_FILE).each do |line|
        next if line !~ /^\d{1,2}\s\d{1,2}(\s\d{1,4})?.*$/
        day, month, year = line.split(' ').map(&:to_i)
        year = @year if year.nil?
        date = Date.new(year, month, day) rescue next  
        hilights << date
      end
      hilights
    end
def hilight_days_from_config_file hilights = [ ] return hilights unless File . exist? ( CONFIG_FILE ) File . readlines ( CONFIG_FILE ) . each do | line | next if line !~ / ^ \d {1,2} \s \d {1,2}( \s \d {1,4})?.*$ / day , month , year = line . split ( ' ' ) . map ( & :to_i ) year = @year if year . nil? date = Date . new ( year , month , day ) rescue next hilights << date end hilights end
read and parse dates from the configuration file
read and parse dates from the configuration file
# protect from malformed config