Class: CalInvite::Providers::IcsContent
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- CalInvite::Providers::IcsContent
- Defined in:
- lib/cal_invite/providers/ics_content.rb
Overview
ICS content provider for generating calendar files in iCalendar format. This provider focuses on generating standards-compliant ICS content that can be used directly or wrapped for file download.
Instance Attribute Summary
Attributes inherited from BaseProvider
Instance Method Summary collapse
-
#generate ⇒ String
Generates the complete ICS calendar content with all event details.
Methods inherited from BaseProvider
Constructor Details
This class inherits a constructor from BaseProvider
Instance Method Details
#generate ⇒ String
Generates the complete ICS calendar content with all event details. Handles both single events and multi-day sessions.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cal_invite/providers/ics_content.rb', line 33 def generate calendar_lines = [ "BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//CalInvite//EN", "CALSCALE:GREGORIAN", "METHOD:#{method_value}" ] calendar_lines << "X-WR-CALNAME:#{escape_text(event.calendar_name)}" if event.calendar_name if event.multi_day_sessions.any? event.multi_day_sessions.each do |session| calendar_lines.concat(generate_vevent(session[:start_time], session[:end_time])) end else calendar_lines.concat(generate_vevent(event.start_time, event.end_time)) end calendar_lines << "END:VCALENDAR" calendar_lines.join("\r\n") end |