icalendar.rb 主仓库
iCalendar -- Internet 会议日历, Ruby 样式 === ### 从 1.x 升级 ### 更好的文档还在来临,但与此同时,从 1.x 升级到 2.0 所需的变更已通过 更新 README 所需的差异 总结说明 --- iCalendar 是一个 Ruby 库,用于处理 iCalendar 文件,其格式由 RFC-5545 定义。示例 --- ### 创建日历和事件 ### ```ruby require 'icalendar'
cal = Icalendar::Calendar.new cal.event do |e| e.dtstart = Icalendar::Values::Date.new('20050428') e.dtend = Icalendar::Values::Date.new('20050429') e.summary = "Meeting with the man." e.description = "Have a long lunch meeting and decide nothing..." e.ip_class = "PRIVATE" end
cal.publish
### 或者,您可以以这种方式创建事件ruby
event = Icalendar::Event.new
event.dtstart = DateTime.civil(2006, 6, 23, 8, 30)
event.summary = "A great event!"
cal.add_event(event)
event2 = cal.event # This automatically adds the event to the calendar
event2.dtstart = DateTime.civil(2006, 6, 24, 8, 30)
event2.summary = "Another great event!"
### 支持属性参数
…
有时我们并不在乎事件的开始或结束是 `Date` 对象还是 `DateTime` 对象。为此,我们可以使用 `DateOrDateTime.new(value)`。调用返回的 `DateOrDateTime` 的 `.call` 方法将立即返回底层的 `Date` 或 `DateTime` 对象。暂无开放 Issues,或尚未同步最近议题。