如何使用 Icalendar::HasComponents?

How do I use Icalendar::HasComponents?

关于 https://github.com/icalendar/icalendar/pull/132:假设我有

@cal = Icalendar::Calendar.new

如何使用 Icalendar::HasComponents 将 X-WR-CALNAME、X-PUBLISHED-TTL 和 X-WR-CALDESC 属性添加到 @cal

我想在我的 .ics 文件中生成这些额外的属性,以便我可以将其添加到 Google 日历和 Outlook 并允许它们指定

比我想象的要简单:

cal = Icalendar::Calendar.new
cal.append_custom_property("X-WR-CALNAME","My Calendar") 
cal.append_custom_property("X-PUBLISHED-TTL","PT1H")  # every hour
cal.append_custom_property("X-WR-CALDESC","My Desc")

参考:https://github.com/icalendar/icalendar/blob/master/lib/icalendar/has_properties.rb