Sha256: f7a48cdd4f59f20e831ab13c3f174b89944b125753bbc79faf09e62ea2011d6e
Contents?: true
Size: 873 Bytes
Versions: 9
Compression:
Stored size: 873 Bytes
Contents
require 'mongoid_occurrences/daily_occurrence/has_scopes' module MongoidOccurrences class DailyOccurrence include Mongoid::Document include HasScopes attr_accessor :operator field :ds, as: :dtstart, type: DateTime field :de, as: :dtend, type: DateTime field :ocid, as: :occurrence_id, type: BSON::ObjectId validates :dtstart, presence: true validates :dtend, presence: true def operator @operator ||= :append end def all_day dtstart.to_i == dtstart.beginning_of_day.to_i && dtend.to_i == dtend.end_of_day.to_i end alias all_day? all_day def <=>(other) sort_key <=> other.sort_key end def sort_key [dtstart, dtend] end def to_range (dtstart..dtend) end def overlaps?(occurrence) to_range.overlaps?(occurrence.to_range) end end end
Version data entries
9 entries across 9 versions & 1 rubygems