module DateBook::ActsAsEvent::InstanceMethods

Instance Methods

Public Instance Methods

next_occurrence(occurrence = nil) click to toggle source
# File lib/date_book/concerns/acts_as_event.rb, line 56
def next_occurrence(occurrence = nil)
  after = occurrence.present? ? occurrence.end_date + 1.second : Time.now
  event_occurrences.ending_after(after).ascending.first
end
popover_url(occurrence = nil) click to toggle source
# File lib/date_book/concerns/acts_as_event.rb, line 68
def popover_url(occurrence = nil)
  DateBook::Engine
    .routes
    .url_helpers
    .popover_calendar_event_path(
      calendar,
      slug,
      occurrence_id: occurrence&.id
    )
end
previous_occurrence(occurrence = nil) click to toggle source
# File lib/date_book/concerns/acts_as_event.rb, line 51
def previous_occurrence(occurrence = nil)
  before = occurrence.present? ? occurrence.start_date : Time.now
  event_occurrences.starting_before(before).descending.first
end
schedule() click to toggle source
Calls superclass method
# File lib/date_book/concerns/acts_as_event.rb, line 44
def schedule
  super || build_schedule(
    date: Time.now.to_date,
    time: Time.now.to_s(:time)
  )
end
url(occurrence = nil) click to toggle source
# File lib/date_book/concerns/acts_as_event.rb, line 61
def url(occurrence = nil)
  DateBook::Engine
    .routes
    .url_helpers
    .calendar_event_path(calendar, slug, occurrence_id: occurrence&.id)
end