module MongoidOccurrences::Occurrence
Public Class Methods
included(base)
click to toggle source
# File lib/mongoid_occurrences/occurrence.rb, line 7 def self.included(base) base.extend ClassMethods base.include Mongoid::Timestamps::Updated base.include HasDailyOccurrences base.prepend HasOperators base.singleton_class.prepend HasOperators::ClassMethods base.prepend HasSchedule base.singleton_class.prepend HasSchedule::ClassMethods end
Public Instance Methods
adjust_dates_for_all_day!()
click to toggle source
# File lib/mongoid_occurrences/occurrence.rb, line 47 def adjust_dates_for_all_day! return unless all_day? return unless dtstart? && dtend? self.dtstart = dtstart.beginning_of_day self.dtend = dtend.end_of_day end
all_day()
click to toggle source
Calls superclass method
# File lib/mongoid_occurrences/occurrence.rb, line 38 def all_day return super unless dtstart.present? && dtend.present? return super unless super.nil? dtstart.to_i == dtstart.beginning_of_day.to_i && dtend.to_i == dtend.end_of_day.to_i end
Also aliased as: all_day?
Private Instance Methods
dtend_must_be_after_dtstart()
click to toggle source
# File lib/mongoid_occurrences/occurrence.rb, line 57 def dtend_must_be_after_dtstart return unless dtstart.present? && dtend.present? if dtend < dtstart errors.add(:dtend, :must_be_after_dtstart) end end