# File lib/schedule.rb, line 59
    def initialize options
      raise ArgumentError, 'specify a valid unit' unless options[:unit] &&
        %w{years months weeks days hours minutes}.include?(options[:unit])
      raise ArgumentError, 'frequency > 1 requires an anchor Time' if options[:frequency] && options[:frequency] != 1 && !options[:anchor]
      @unit = options[:unit].to_sym
      raise ArgumentError, 'weekdays are required with the weeks param, if there are times params' if @unit == :weeks && 
        options[:times] && 
        !options[:weekdays]
      @frequency = options[:frequency] || 1
      @anchor = options[:anchor]
      @times = parse_times options[:times]
      if options[:months]
        @months = Array(options[:months]).collect{|d|d.to_s.downcase.to_sym}
        raise ArgumentError, 'provide valid months' unless @months.all?{|m|ordinal_month(m)}
      end
      
      @weeks = Array(options[:weeks]).collect{|n|n.to_i} if options[:weeks]
      if options[:weekdays]
        @weekdays = Array(options[:weekdays]).collect{|d|d.to_s.downcase.to_sym}
        raise ArgumentError, 'provide valid weekdays' unless @weekdays.all?{|w|ordinal_weekday(w)}
      end
      @monthdays = Array(options[:monthdays]).collect{|n|n.to_i} if options[:monthdays]
      
     
      @anchor_multiple = options[:times].nil? && options[:weeks].nil? && options[:weekdays].nil? && options[:monthdays].nil?
    end