Skip to content

Instantly share code, notes, and snippets.

@macks
Created November 25, 2010 19:34
Show Gist options
  • Save macks/715813 to your computer and use it in GitHub Desktop.
Save macks/715813 to your computer and use it in GitHub Desktop.
icalendar sample
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