Class: MongoidOccurrences::DailyOccurrence
- Inherits:
-
Object
- Object
- MongoidOccurrences::DailyOccurrence
- Includes:
- Mongoid::Document, HasScopes
- Defined in:
- lib/mongoid_occurrences/daily_occurrence.rb,
lib/mongoid_occurrences/daily_occurrence/has_scopes.rb
Defined Under Namespace
Modules: HasScopes
Instance Attribute Summary collapse
-
#operator ⇒ Object
Returns the value of attribute operator.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #all_day ⇒ Object (also: #all_day?)
- #overlaps?(occurrence) ⇒ Boolean
- #sort_key ⇒ Object
- #to_range ⇒ Object
Methods included from HasScopes
Instance Attribute Details
#operator ⇒ Object
Returns the value of attribute operator.
8 9 10 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 8 def operator @operator end |
Instance Method Details
#<=>(other) ⇒ Object
28 29 30 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 28 def <=>(other) sort_key <=> other.sort_key end |
#all_day ⇒ Object Also known as: all_day?
22 23 24 25 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 22 def all_day dtstart.to_i == dtstart.beginning_of_day.to_i && dtend.to_i == dtend.end_of_day.to_i end |
#overlaps?(occurrence) ⇒ Boolean
40 41 42 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 40 def overlaps?(occurrence) to_range.overlaps?(occurrence.to_range) end |
#sort_key ⇒ Object
32 33 34 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 32 def sort_key [dtstart, dtend] end |
#to_range ⇒ Object
36 37 38 |
# File 'lib/mongoid_occurrences/daily_occurrence.rb', line 36 def to_range (dtstart..dtend) end |