icalendar 0.95

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/COPYING +56 -0
  2. data/GPL +340 -0
  3. data/README +121 -0
  4. data/Rakefile +101 -0
  5. data/docs/api/classes/Array.html +146 -0
  6. data/docs/api/classes/Date.html +157 -0
  7. data/docs/api/classes/DateTime.html +178 -0
  8. data/docs/api/classes/Fixnum.html +146 -0
  9. data/docs/api/classes/Float.html +146 -0
  10. data/docs/api/classes/Icalendar/Alarm.html +184 -0
  11. data/docs/api/classes/Icalendar/Base.html +118 -0
  12. data/docs/api/classes/Icalendar/Calendar.html +411 -0
  13. data/docs/api/classes/Icalendar/Component.html +306 -0
  14. data/docs/api/classes/Icalendar/DateProp.html +187 -0
  15. data/docs/api/classes/Icalendar/DateProp/ClassMethods.html +195 -0
  16. data/docs/api/classes/Icalendar/Event.html +202 -0
  17. data/docs/api/classes/Icalendar/Freebusy.html +157 -0
  18. data/docs/api/classes/Icalendar/InvalidComponentClass.html +117 -0
  19. data/docs/api/classes/Icalendar/InvalidPropertyValue.html +117 -0
  20. data/docs/api/classes/Icalendar/Journal.html +190 -0
  21. data/docs/api/classes/Icalendar/Parameter.html +166 -0
  22. data/docs/api/classes/Icalendar/Parser.html +447 -0
  23. data/docs/api/classes/Icalendar/Timezone.html +197 -0
  24. data/docs/api/classes/Icalendar/Todo.html +199 -0
  25. data/docs/api/classes/String.html +160 -0
  26. data/docs/api/classes/Time.html +161 -0
  27. data/docs/api/created.rid +1 -0
  28. data/docs/api/files/COPYING.html +163 -0
  29. data/docs/api/files/GPL.html +531 -0
  30. data/docs/api/files/README.html +241 -0
  31. data/docs/api/files/lib/icalendar/base_rb.html +108 -0
  32. data/docs/api/files/lib/icalendar/calendar_rb.html +101 -0
  33. data/docs/api/files/lib/icalendar/component/alarm_rb.html +101 -0
  34. data/docs/api/files/lib/icalendar/component/event_rb.html +101 -0
  35. data/docs/api/files/lib/icalendar/component/freebusy_rb.html +101 -0
  36. data/docs/api/files/lib/icalendar/component/journal_rb.html +101 -0
  37. data/docs/api/files/lib/icalendar/component/timezone_rb.html +101 -0
  38. data/docs/api/files/lib/icalendar/component/todo_rb.html +101 -0
  39. data/docs/api/files/lib/icalendar/component_rb.html +101 -0
  40. data/docs/api/files/lib/icalendar/conversions_rb.html +108 -0
  41. data/docs/api/files/lib/icalendar/helpers_rb.html +101 -0
  42. data/docs/api/files/lib/icalendar/parameter_rb.html +101 -0
  43. data/docs/api/files/lib/icalendar/parser_rb.html +109 -0
  44. data/docs/api/files/lib/icalendar_rb.html +118 -0
  45. data/docs/api/fr_class_index.html +48 -0
  46. data/docs/api/fr_file_index.html +43 -0
  47. data/docs/api/fr_method_index.html +63 -0
  48. data/docs/api/index.html +24 -0
  49. data/docs/api/rdoc-style.css +208 -0
  50. data/docs/examples/create_cal.rb +40 -0
  51. data/docs/examples/parse_cal.rb +19 -0
  52. data/docs/examples/single_event.ics +18 -0
  53. data/docs/rfcs/rfc2425.pdf +0 -0
  54. data/docs/rfcs/rfc2426.pdf +0 -0
  55. data/docs/rfcs/rfc2445.pdf +0 -0
  56. data/docs/rfcs/rfc2446.pdf +0 -0
  57. data/docs/rfcs/rfc2447.pdf +0 -0
  58. data/docs/rfcs/rfc3283.txt +738 -0
  59. data/lib/icalendar.rb +27 -0
  60. data/lib/icalendar/#helpers.rb# +92 -0
  61. data/lib/icalendar/base.rb +31 -0
  62. data/lib/icalendar/calendar.rb +112 -0
  63. data/lib/icalendar/component.rb +253 -0
  64. data/lib/icalendar/component/alarm.rb +35 -0
  65. data/lib/icalendar/component/event.rb +68 -0
  66. data/lib/icalendar/component/freebusy.rb +35 -0
  67. data/lib/icalendar/component/journal.rb +61 -0
  68. data/lib/icalendar/component/timezone.rb +43 -0
  69. data/lib/icalendar/component/todo.rb +65 -0
  70. data/lib/icalendar/conversions.rb +115 -0
  71. data/lib/icalendar/helpers.rb +109 -0
  72. data/lib/icalendar/parameter.rb +33 -0
  73. data/lib/icalendar/parser.rb +395 -0
  74. data/test/calendar_test.rb +46 -0
  75. data/test/component/event_test.rb +47 -0
  76. data/test/component_test.rb +74 -0
  77. data/test/parser_test.rb +83 -0
  78. data/test/property_helpers.rb +35 -0
  79. data/test/simplecal.ics +119 -0
  80. data/test/single_event.ics +23 -0
  81. metadata +135 -0
@@ -0,0 +1,101 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ PKG_VERSION = "0.95"
7
+
8
+ $VERBOSE = nil
9
+ TEST_CHANGES_SINCE = Time.now - 600 # Recent tests = changed in last 10 minutes
10
+
11
+ desc "Run all the unit tests"
12
+ task :default => [ :test, :lines ]
13
+
14
+ # Look up tests for recently modified sources.
15
+ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
16
+ FileList[source_pattern].map do |path|
17
+ if File.mtime(path) > touched_since
18
+ test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
19
+ test if File.exists?(test)
20
+ end
21
+ end.compact
22
+ end
23
+
24
+ desc 'Test recent changes.'
25
+ Rake::TestTask.new(:rtest) do |t|
26
+ since = TEST_CHANGES_SINCE
27
+ touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
28
+ recent_tests('lib/icalendar/*.rb', 'test', since) +
29
+ recent_tests('lib/icalendar/component/*.rb', 'test/component', since)
30
+
31
+ t.libs << 'test'
32
+ t.verbose = true
33
+ t.test_files = touched.uniq
34
+ end
35
+
36
+ desc "Run the unit tests in test"
37
+ Rake::TestTask.new(:test) { |t|
38
+ t.libs << "test"
39
+ t.test_files = FileList['test/*_test.rb', 'test/component/*_test.rb']
40
+ t.verbose = true
41
+ }
42
+
43
+ # Generate the RDoc documentation
44
+ Rake::RDocTask.new(:doc) { |rdoc|
45
+ rdoc.main = 'README'
46
+ rdoc.rdoc_files.include('lib/**/*.rb', 'README')
47
+ rdoc.rdoc_files.include('GPL', 'COPYING')
48
+ rdoc.rdoc_dir = 'docs/api'
49
+ rdoc.title = "iCalendar -- Internet Calendaring for Ruby"
50
+ rdoc.options << "--include examples/ --line-numbers --inline-source "
51
+ rdoc.options << ""
52
+ }
53
+
54
+ Gem::manage_gems
55
+ require 'rake/gempackagetask'
56
+
57
+ spec = Gem::Specification.new do |s|
58
+ s.name = "icalendar"
59
+ s.version = PKG_VERSION
60
+ s.homepage = "http://icalendar.rubyforge.org/"
61
+ s.platform = Gem::Platform::RUBY
62
+ s.summary = "A ruby implementation of the iCalendar specification (RFC-2445)."
63
+ s.description = "Implements the iCalendar specification (RFC-2445) in Ruby. This allows for the generation and parsing of .ics files, which are used by a variety of calendaring applications."
64
+
65
+ s.files = FileList["{test,lib,docs,examples}/**/*"].to_a
66
+ s.files += ["Rakefile", "README", "COPYING", "GPL" ]
67
+ s.require_path = "lib"
68
+ s.autorequire = "icalendar"
69
+ s.has_rdoc = true
70
+ s.extra_rdoc_files = ["README", "COPYING", "GPL"]
71
+ s.rdoc_options.concat ['--main', 'README']
72
+
73
+ s.author = "Jeff Rose"
74
+ s.email = "rosejn@gmail.com"
75
+ end
76
+
77
+ Rake::GemPackageTask.new(spec) do |pkg|
78
+ pkg.gem_spec = spec
79
+ pkg.need_tar = true
80
+ pkg.need_zip = true
81
+ end
82
+
83
+ task :lines do
84
+ lines = 0
85
+ codelines = 0
86
+ Dir.foreach("lib/icalendar") { |file_name|
87
+ next unless file_name =~ /.*rb/
88
+
89
+ f = File.open("lib/icalendar/" + file_name)
90
+
91
+ while line = f.gets
92
+ lines += 1
93
+ next if line =~ /^\s*$/
94
+ next if line =~ /^\s*#/
95
+ codelines += 1
96
+ end
97
+ }
98
+ puts "\n------------------------------\n"
99
+ puts "Total Lines: #{lines}"
100
+ puts "Lines of Code: #{codelines}"
101
+ end
@@ -0,0 +1,146 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Array</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Array</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/icalendar/conversions_rb.html">
59
+ lib/icalendar/conversions.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000002">to_ical</a>&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ <!-- if includes -->
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Instance methods</h3>
110
+
111
+ <div id="method-M000002" class="method-detail">
112
+ <a name="M000002"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="#M000002" class="method-signature">
116
+ <span class="method-name">to_ical</span><span class="method-args">()</span>
117
+ </a>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+ <p><a class="source-toggle" href="#"
122
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
123
+ <div class="method-source-code" id="M000002-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/icalendar/conversions.rb, line 38</span>
126
+ 38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ical</span>
127
+ 39: <span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">elem</span><span class="ruby-operator">|</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">to_ical</span>}.<span class="ruby-identifier">join</span> <span class="ruby-value str">','</span>
128
+ 40: <span class="ruby-keyword kw">end</span>
129
+ </pre>
130
+ </div>
131
+ </div>
132
+ </div>
133
+
134
+
135
+ </div>
136
+
137
+
138
+ </div>
139
+
140
+
141
+ <div id="validator-badges">
142
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
143
+ </div>
144
+
145
+ </body>
146
+ </html>
@@ -0,0 +1,157 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Date</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Date</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/icalendar/conversions_rb.html">
59
+ lib/icalendar/conversions.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000004">to_ical</a>&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ <!-- if includes -->
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Instance methods</h3>
110
+
111
+ <div id="method-M000004" class="method-detail">
112
+ <a name="M000004"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="#M000004" class="method-signature">
116
+ <span class="method-name">to_ical</span><span class="method-args">(utc = false)</span>
117
+ </a>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+ <p><a class="source-toggle" href="#"
122
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
123
+ <div class="method-source-code" id="M000004-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/icalendar/conversions.rb, line 80</span>
126
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ical</span>(<span class="ruby-identifier">utc</span> = <span class="ruby-keyword kw">false</span>)
127
+ 81: <span class="ruby-identifier">s</span> = <span class="ruby-value str">&quot;&quot;</span>
128
+ 82:
129
+ 83: <span class="ruby-comment cmt"># 4 digit year</span>
130
+ 84: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_s</span>
131
+ 85:
132
+ 86: <span class="ruby-comment cmt"># Double digit month</span>
133
+ 87: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
134
+ 88: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_s</span>
135
+ 89:
136
+ 90: <span class="ruby-comment cmt"># Double digit day</span>
137
+ 91: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
138
+ 92: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_s</span>
139
+ 93: <span class="ruby-keyword kw">end</span>
140
+ </pre>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+
146
+ </div>
147
+
148
+
149
+ </div>
150
+
151
+
152
+ <div id="validator-badges">
153
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
154
+ </div>
155
+
156
+ </body>
157
+ </html>
@@ -0,0 +1,178 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: DateTime</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">DateTime</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/icalendar/conversions_rb.html">
59
+ lib/icalendar/conversions.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Date.html">
69
+ Date
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000005">to_ical</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Instance methods</h3>
112
+
113
+ <div id="method-M000005" class="method-detail">
114
+ <a name="M000005"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000005" class="method-signature">
118
+ <span class="method-name">to_ical</span><span class="method-args">(utc = false)</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p><a class="source-toggle" href="#"
124
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000005-source">
126
+ <pre>
127
+ <span class="ruby-comment cmt"># File lib/icalendar/conversions.rb, line 44</span>
128
+ 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ical</span>(<span class="ruby-identifier">utc</span> = <span class="ruby-keyword kw">false</span>)
129
+ 45: <span class="ruby-identifier">s</span> = <span class="ruby-value str">&quot;&quot;</span>
130
+ 46:
131
+ 47: <span class="ruby-comment cmt"># 4 digit year</span>
132
+ 48: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_s</span>
133
+ 49:
134
+ 50: <span class="ruby-comment cmt"># Double digit month</span>
135
+ 51: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
136
+ 52: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_s</span>
137
+ 53:
138
+ 54: <span class="ruby-comment cmt"># Double digit day</span>
139
+ 55: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
140
+ 56: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_s</span>
141
+ 57:
142
+ 58: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;T&quot;</span>
143
+ 59:
144
+ 60: <span class="ruby-comment cmt"># Double digit hour</span>
145
+ 61: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
146
+ 62: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hour</span>.<span class="ruby-identifier">to_s</span>
147
+ 63:
148
+ 64: <span class="ruby-comment cmt"># Double digit minute</span>
149
+ 65: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
150
+ 66: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min</span>.<span class="ruby-identifier">to_s</span>
151
+ 67:
152
+ 68: <span class="ruby-comment cmt"># Double digit second</span>
153
+ 69: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">9</span>
154
+ 70: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sec</span>.<span class="ruby-identifier">to_s</span>
155
+ 71:
156
+ 72: <span class="ruby-comment cmt"># UTC time gets a Z suffix</span>
157
+ 73: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">utc</span>
158
+ 74: <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Z&quot;</span>
159
+ 75: <span class="ruby-keyword kw">end</span>
160
+ 76: <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+
167
+ </div>
168
+
169
+
170
+ </div>
171
+
172
+
173
+ <div id="validator-badges">
174
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
175
+ </div>
176
+
177
+ </body>
178
+ </html>