module MongoidOccurrences::HasFieldsFromAggregation

Public Instance Methods

all_day() click to toggle source
# File lib/mongoid_occurrences/has_fields_from_aggregation.rb, line 19
def all_day
  return unless dtstart && dtend

  dtstart.to_i == dtstart.beginning_of_day.to_i &&
    dtend.to_i == dtend.end_of_day.to_i
end
Also aliased as: all_day?
all_day?()
Alias for: all_day
dtend() click to toggle source
# File lib/mongoid_occurrences/has_fields_from_aggregation.rb, line 11
def dtend
  return if daily_occurrences.blank?
  @dtend ||= DateTime.demongoize(
    self['_dtend'] ||
      daily_occurrences.unscoped.order(dtend: :desc).limit(1).pluck(:dtend).first
  )
end
dtstart() click to toggle source
# File lib/mongoid_occurrences/has_fields_from_aggregation.rb, line 3
def dtstart
  return if daily_occurrences.blank?
  @dtstart ||= DateTime.demongoize(
    self['_dtstart'] ||
      daily_occurrences.unscoped.order(dtstart: :asc).limit(1).pluck(:dtstart).first
  )
end