Sha256: 30d219dd46e9bd3b193e6d1cc723e7fb61810b9e24f59e694bcd29a83b6e75d8

Contents?: true

Size: 1.78 KB

Versions: 49

Compression:

Stored size: 1.78 KB

Contents

module RiCal
  class PropertyValue
    class RecurrenceRule < PropertyValue
      #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
      #
      # Instances of RecurringMonthDay represent BYMONTHDAY parts in recurrence rules
      class RecurringMonthDay < NumberedSpan # :nodoc:

        def last
          31
        end
        
        # return a list id for a given time to allow the enumerator to cache lists
        def list_id(time)
          time.month
        end
 
        # return a list of times which match the time parameter within the scope of the RecurringDay
        def matches_for(time)
          [time.change(:day => 1).advance(:days => target_for(time)- 1)]
        end
        
        # return a list id for a given time to allow the enumerator to cache lists
        def list_id(time)
          time.month
        end
 
        # return a list of times which match the time parameter within the scope of the RecurringDay
        def matches_for(time)
          [time.change(:day => 1).advance(:days => target_for(time)- 1)]
        end
        
        def target_date_time_for(date_time)
          matches_for(date_time)[0]
        end

        # return a list of times which match the time parameter within the scope of the RecurringDay
        def matches_for(time)
          [time.change(:day => 1).advance(:days => target_for(time)- 1)]
        end

        def target_date_time_for(date_time)
          matches_for(date_time)[0]
        end

        def target_for(date_or_time)
          if @source > 0
            @source
          else
            date_or_time.days_in_month + @source + 1
          end
        end

        def include?(date_or_time)
          date_or_time.mday == target_for(date_or_time)
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 3 rubygems

Version Path
ebeigarts-ri_cal-0.8.1 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.10 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.11 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.3 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.4 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.5 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.6 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.7 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.8 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.0.9 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.5.0 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.5.1 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.5.2 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.5.3 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.6.0 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.6.1 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.6.2 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.6.3 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.7.0 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb
rubyredrick-ri_cal-0.7.1 lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb