0

我正在使用ri_calgem 来创建 ics 文件。gem 的文档建议我这样做:

RiCal.Calendar do |cal|
  cal.event do |event|
    event.description = "MA-6 First US Manned Spaceflight"
    event.dtstart =  DateTime.parse("2/20/1962 14:47:39")
    event.dtend = DateTime.parse("2/20/1962 19:43:02")
    event.location = "Cape Canaveral"
    event.add_attendee "john.glenn@nasa.gov"
    event.alarm do
      description "Segment 51"
    end
  end
end

但是当我打开在 OS X 日历中创建的 .ics 文件时,该事件没有标题。仅描述已按描述进行设置。

如何设置活动的标题?

4

1 回答 1

3

使用event.summary

RiCal.Calendar do |cal|
  cal.event do |event|
    event.summary = "The 'title' of the event"
    event.description = "MA-6 First US Manned Spaceflight"
    event.dtstart =  DateTime.parse("2/20/1962 14:47:39")
    event.dtend = DateTime.parse("2/20/1962 19:43:02")
    event.location = "Cape Canaveral"
    event.add_attendee "john.glenn@nasa.gov"
    event.alarm do
      description "Segment 51"
    end
  end
end

ri_cal/properties/event.rb包含您可以设置的完整属性列表。

于 2013-03-06T05:09:37.797 回答