Created
November 25, 2010 19:34
-
-
Save macks/715813 to your computer and use it in GitHub Desktop.
icalendar sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'rubygems' | |
require 'bundler' | |
Bundler.setup | |
require 'icalendar' | |
cal = Icalendar::Calendar.new | |
cal.timezone do | |
tzid 'Tokyo/Asia' | |
standard do | |
tzoffsetfrom '+0900' | |
tzoffsetto '+0900' | |
tzname 'JST' | |
end | |
end | |
cal.event do | |
dtstart DateTime.new(2005, 1, 1, 13, 0, 0, Rational(3,8)) | |
dtend DateTime.new(2005, 1, 1, 15, 0, 0, Rational(3,8)) | |
summary 'イベント1' | |
description '詳しい説明' | |
klass 'PUBLIC' | |
end | |
cal.event do | |
dtstart DateTime.new(2005, 1, 2, 13, 0, 0, Rational(3,8)) | |
dtend DateTime.new(2005, 1, 2, 15, 0, 0, Rational(3,8)) | |
summary 'イベント2' | |
description '詳しい説明' | |
klass 'PUBLIC' | |
end | |
cal.publish | |
puts cal.to_ical |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment