icalendar 0.96.4 → 0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +66 -53
- data/Rakefile +33 -24
- data/docs/api/classes/Array.html +9 -11
- data/docs/api/classes/Array.src/M000002.html +18 -0
- data/docs/api/classes/Date.html +2 -22
- data/docs/api/classes/Date.src/M000004.html +29 -0
- data/docs/api/classes/DateTime.html +2 -43
- data/docs/api/classes/DateTime.src/M000005.html +50 -0
- data/docs/api/classes/Fixnum.html +2 -11
- data/docs/api/classes/Fixnum.src/M000011.html +18 -0
- data/docs/api/classes/Float.html +2 -11
- data/docs/api/classes/Float.src/M000003.html +18 -0
- data/docs/api/classes/HashAttrs.html +15 -60
- data/docs/api/classes/HashAttrs.src/M000068.html +26 -0
- data/docs/api/classes/HashAttrs.src/M000069.html +27 -0
- data/docs/api/classes/HashAttrs.src/M000070.html +19 -0
- data/docs/api/classes/Icalendar/Alarm.html +5 -15
- data/docs/api/classes/Icalendar/Alarm.src/M000020.html +22 -0
- data/docs/api/classes/Icalendar/Base.html +41 -0
- data/docs/api/classes/Icalendar/Base.src/M000022.html +18 -0
- data/docs/api/classes/Icalendar/Base.src/M000023.html +18 -0
- data/docs/api/classes/Icalendar/Calendar.html +116 -116
- data/docs/api/classes/Icalendar/Calendar.src/M000054.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000055.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000056.html +18 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000057.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000058.html +18 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000059.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000060.html +18 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000061.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000062.html +18 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000063.html +23 -0
- data/docs/api/classes/Icalendar/Calendar.src/M000064.html +19 -0
- data/docs/api/classes/Icalendar/Component.html +200 -367
- data/docs/api/classes/Icalendar/Component.src/M000029.html +22 -0
- data/docs/api/classes/Icalendar/Component.src/M000030.html +24 -0
- data/docs/api/classes/Icalendar/Component.src/M000035.html +22 -0
- data/docs/api/classes/Icalendar/Component.src/M000040.html +18 -0
- data/docs/api/classes/Icalendar/Component.src/M000041.html +24 -0
- data/docs/api/classes/Icalendar/Component.src/M000042.html +28 -0
- data/docs/api/classes/Icalendar/Component.src/M000043.html +37 -0
- data/docs/api/classes/Icalendar/Component.src/M000044.html +37 -0
- data/docs/api/classes/Icalendar/Component.src/M000045.html +18 -0
- data/docs/api/classes/Icalendar/Component.src/M000046.html +18 -0
- data/docs/api/classes/Icalendar/Component.src/M000047.html +18 -0
- data/docs/api/classes/Icalendar/Component.src/M000048.html +26 -0
- data/docs/api/classes/Icalendar/Component.src/M000049.html +29 -0
- data/docs/api/classes/Icalendar/Component.src/M000050.html +22 -0
- data/docs/api/classes/Icalendar/DateProp.html +2 -12
- data/docs/api/classes/Icalendar/DateProp.src/M000013.html +19 -0
- data/docs/api/classes/Icalendar/DateProp/ClassMethods.html +2 -59
- data/docs/api/classes/Icalendar/DateProp/ClassMethods.src/M000014.html +66 -0
- data/docs/api/classes/Icalendar/Daylight.html +5 -14
- data/docs/api/classes/Icalendar/Daylight.src/M000051.html +18 -0
- data/docs/api/classes/Icalendar/Event.html +30 -37
- data/docs/api/classes/Icalendar/Event.src/M000052.html +23 -0
- data/docs/api/classes/Icalendar/Event.src/M000053.html +23 -0
- data/docs/api/classes/Icalendar/Freebusy.html +5 -14
- data/docs/api/classes/Icalendar/Freebusy.src/M000065.html +21 -0
- data/docs/api/classes/Icalendar/Geo.html +192 -0
- data/docs/api/classes/Icalendar/Geo.src/M000024.html +19 -0
- data/docs/api/classes/Icalendar/Geo.src/M000025.html +18 -0
- data/docs/api/classes/Icalendar/Journal.html +2 -11
- data/docs/api/classes/Icalendar/Journal.src/M000016.html +22 -0
- data/docs/api/classes/Icalendar/Parameter.html +5 -23
- data/docs/api/classes/Icalendar/Parameter.src/M000066.html +27 -0
- data/docs/api/classes/Icalendar/Parser.html +36 -212
- data/docs/api/classes/Icalendar/Parser.src/M000017.html +32 -0
- data/docs/api/classes/Icalendar/Parser.src/M000018.html +43 -0
- data/docs/api/classes/Icalendar/Parser.src/M000019.html +33 -0
- data/docs/api/classes/Icalendar/Standard.html +2 -11
- data/docs/api/classes/Icalendar/Standard.src/M000015.html +18 -0
- data/docs/api/classes/Icalendar/Timezone.html +16 -48
- data/docs/api/classes/Icalendar/Timezone.src/M000026.html +19 -0
- data/docs/api/classes/Icalendar/Timezone.src/M000027.html +22 -0
- data/docs/api/classes/Icalendar/Timezone.src/M000028.html +18 -0
- data/docs/api/classes/Icalendar/Todo.html +5 -14
- data/docs/api/classes/Icalendar/Todo.src/M000021.html +22 -0
- data/docs/api/classes/Object.html +10 -59
- data/docs/api/classes/Object.src/M000006.html +20 -0
- data/docs/api/classes/Object.src/M000007.html +18 -0
- data/docs/api/classes/Object.src/M000008.html +20 -0
- data/docs/api/classes/Object.src/M000009.html +18 -0
- data/docs/api/classes/Object.src/M000010.html +18 -0
- data/docs/api/classes/String.html +2 -11
- data/docs/api/classes/String.src/M000012.html +18 -0
- data/docs/api/classes/Time.html +2 -26
- data/docs/api/classes/Time.src/M000001.html +37 -0
- data/docs/api/classes/URI/Generic.html +5 -14
- data/docs/api/classes/URI/Generic.src/M000067.html +18 -0
- data/docs/api/created.rid +1 -1
- data/docs/api/files/COPYING.html +1 -1
- data/docs/api/files/GPL.html +1 -1
- data/docs/api/files/README.html +76 -64
- data/docs/api/files/lib/hash_attrs_rb.html +1 -1
- data/docs/api/files/lib/icalendar/base_rb.html +1 -1
- data/docs/api/files/lib/icalendar/calendar_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/alarm_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/event_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/freebusy_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/journal_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/timezone_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component/todo_rb.html +1 -1
- data/docs/api/files/lib/icalendar/component_rb.html +8 -1
- data/docs/api/files/lib/icalendar/conversions_rb.html +1 -1
- data/docs/api/files/lib/icalendar/helpers_rb.html +1 -1
- data/docs/api/files/lib/icalendar/parameter_rb.html +1 -1
- data/docs/api/files/lib/icalendar/parser_rb.html +2 -1
- data/docs/api/files/lib/icalendar_rb.html +1 -1
- data/docs/api/files/lib/meta_rb.html +1 -1
- data/docs/api/fr_class_index.html +1 -0
- data/docs/api/fr_method_index.html +57 -41
- data/docs/rfcs/itip_notes.txt +69 -0
- data/examples/create_cal.rb +33 -32
- data/examples/parse_cal.rb +2 -2
- data/lib/icalendar/base.rb +8 -0
- data/lib/icalendar/calendar.rb +32 -3
- data/lib/icalendar/component.rb +187 -113
- data/lib/icalendar/component/alarm.rb +3 -0
- data/lib/icalendar/component/event.rb +9 -3
- data/lib/icalendar/component/freebusy.rb +3 -0
- data/lib/icalendar/component/journal.rb +4 -0
- data/lib/icalendar/component/todo.rb +4 -0
- data/lib/icalendar/conversions.rb +7 -1
- data/lib/icalendar/parser.rb +68 -90
- data/test/calendar_test.rb +32 -8
- data/test/component/event_test.rb +4 -7
- data/test/component/todo_test.rb +13 -0
- data/test/component_test.rb +21 -34
- data/test/conversions_test.rb +66 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-hash_attrs_rb.html +574 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-base_rb.html +575 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-calendar_rb.html +629 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-alarm_rb.html +581 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-event_rb.html +658 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-freebusy_rb.html +574 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-journal_rb.html +597 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-timezone_rb.html +625 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component-todo_rb.html +600 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-component_rb.html +924 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-conversions_rb.html +667 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar-parser_rb.html +938 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-icalendar_rb.html +576 -0
- data/test/coverage/-home-rosejn-projects-icalendar-lib-meta_rb.html +572 -0
- data/test/coverage/calendar_test_rb.html +590 -0
- data/test/coverage/component_test_rb.html +602 -0
- data/test/coverage/index.html +1009 -0
- data/test/coverage/lib-hash_attrs_rb.html +574 -0
- data/test/coverage/lib-icalendar-base_rb.html +583 -0
- data/test/coverage/lib-icalendar-calendar_rb.html +631 -0
- data/test/coverage/lib-icalendar-component-alarm_rb.html +581 -0
- data/test/coverage/lib-icalendar-component-event_rb.html +661 -0
- data/test/coverage/lib-icalendar-component-freebusy_rb.html +576 -0
- data/test/coverage/lib-icalendar-component-journal_rb.html +599 -0
- data/test/coverage/lib-icalendar-component-timezone_rb.html +625 -0
- data/test/coverage/lib-icalendar-component-todo_rb.html +602 -0
- data/test/coverage/lib-icalendar-component_rb.html +941 -0
- data/test/coverage/lib-icalendar-conversions_rb.html +673 -0
- data/test/coverage/lib-icalendar-parser_rb.html +916 -0
- data/test/coverage/lib-icalendar_rb.html +576 -0
- data/test/coverage/lib-meta_rb.html +572 -0
- data/test/coverage/parameter_test_rb.html +569 -0
- data/test/coverage/parser_test_rb.html +623 -0
- data/test/coverage/test-calendar_test_rb.html +590 -0
- data/test/coverage/test-component-event_test_rb.html +584 -0
- data/test/coverage/test-component_test_rb.html +606 -0
- data/test/coverage/test-conversions_test_rb.html +603 -0
- data/test/coverage/test-parameter_test_rb.html +569 -0
- data/test/coverage/test-parser_test_rb.html +624 -0
- data/test/interactive.rb +3 -1
- data/test/life.ics +46 -1092
- data/test/parameter_test.rb +11 -2
- data/test/parser_test.rb +12 -11
- metadata +259 -126
- data/test/old_life.ics +0 -46
- data/test/rw.ics +0 -947
|
@@ -0,0 +1,22 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>new (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 43</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)
|
|
15
|
+
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
|
16
|
+
<span class="ruby-ivar">@components</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>([])
|
|
17
|
+
<span class="ruby-ivar">@properties</span> = {}
|
|
18
|
+
|
|
19
|
+
<span class="ruby-ivar">@@logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"New #{@name[1,@name.size].capitalize}..."</span>)
|
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>add_component (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 52</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_component</span>(<span class="ruby-identifier">component</span>)
|
|
15
|
+
<span class="ruby-identifier">key</span> = (<span class="ruby-identifier">component</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'s'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'icalendar::'</span>, <span class="ruby-value str">''</span>).<span class="ruby-identifier">to_sym</span>
|
|
16
|
+
|
|
17
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@components</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">key</span>
|
|
18
|
+
<span class="ruby-ivar">@components</span>[<span class="ruby-identifier">key</span>] = []
|
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
|
20
|
+
|
|
21
|
+
<span class="ruby-ivar">@components</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">component</span>
|
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>remove_component (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 74</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_component</span>(<span class="ruby-identifier">component</span>)
|
|
15
|
+
<span class="ruby-identifier">key</span> = (<span class="ruby-identifier">component</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'s'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'icalendar::'</span>, <span class="ruby-value str">''</span>).<span class="ruby-identifier">to_sym</span>
|
|
16
|
+
|
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@components</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">key</span>
|
|
18
|
+
<span class="ruby-ivar">@components</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">component</span>)
|
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>new_uid (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 95</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_uid</span>
|
|
15
|
+
<span class="ruby-node">"#{DateTime.now}_#{rand(999999999)}@#{Socket.gethostname}"</span>
|
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>to_ical (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 100</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ical</span>
|
|
15
|
+
<span class="ruby-identifier">print_component</span> <span class="ruby-keyword kw">do</span>
|
|
16
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-value str">""</span>
|
|
17
|
+
<span class="ruby-ivar">@components</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">comps</span><span class="ruby-operator">|</span>
|
|
18
|
+
<span class="ruby-identifier">comps</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">component</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">component</span>.<span class="ruby-identifier">to_ical</span> }
|
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
|
20
|
+
<span class="ruby-identifier">s</span>
|
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>print_component (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 111</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_component</span>
|
|
15
|
+
<span class="ruby-comment cmt"># Begin a new component</span>
|
|
16
|
+
<span class="ruby-node">"BEGIN:#{@name.upcase}\r\n"</span> <span class="ruby-operator">+</span>
|
|
17
|
+
|
|
18
|
+
<span class="ruby-comment cmt"># Then the properties</span>
|
|
19
|
+
<span class="ruby-identifier">print_properties</span> <span class="ruby-operator">+</span>
|
|
20
|
+
|
|
21
|
+
<span class="ruby-comment cmt"># sub components</span>
|
|
22
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-operator">+</span>
|
|
23
|
+
|
|
24
|
+
<span class="ruby-comment cmt"># End of this component</span>
|
|
25
|
+
<span class="ruby-node">"END:#{@name.upcase}\r\n"</span>
|
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>print_properties (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 126</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_properties</span>
|
|
15
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-value str">""</span>
|
|
16
|
+
|
|
17
|
+
<span class="ruby-ivar">@properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
|
18
|
+
<span class="ruby-comment cmt"># Take out underscore for property names that conflicted</span>
|
|
19
|
+
<span class="ruby-comment cmt"># with built-in words.</span>
|
|
20
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/ip_.*/</span>
|
|
21
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
|
23
|
+
|
|
24
|
+
<span class="ruby-comment cmt"># Property name</span>
|
|
25
|
+
<span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{key.upcase}"</span> <span class="ruby-operator">+</span>
|
|
26
|
+
|
|
27
|
+
<span class="ruby-comment cmt"># Possible parameters</span>
|
|
28
|
+
<span class="ruby-identifier">print_parameters</span>(<span class="ruby-identifier">val</span>) <span class="ruby-operator">+</span>
|
|
29
|
+
|
|
30
|
+
<span class="ruby-comment cmt"># Property value</span>
|
|
31
|
+
<span class="ruby-node">":#{val.to_ical}\r\n"</span>
|
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
|
33
|
+
|
|
34
|
+
<span class="ruby-identifier">s</span>
|
|
35
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>print_parameters (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 150</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_parameters</span>(<span class="ruby-identifier">val</span>)
|
|
15
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-value str">""</span>
|
|
16
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:ical_params</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">ical_params</span>.<span class="ruby-identifier">nil?</span>
|
|
17
|
+
|
|
18
|
+
<span class="ruby-identifier">val</span>.<span class="ruby-identifier">ical_params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
|
19
|
+
<span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-node">";#{key}"</span>
|
|
20
|
+
<span class="ruby-identifier">val</span> = [ <span class="ruby-identifier">val</span> ] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
|
21
|
+
|
|
22
|
+
<span class="ruby-comment cmt"># Possible parameter values</span>
|
|
23
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">empty?</span>
|
|
24
|
+
<span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"="</span>
|
|
25
|
+
<span class="ruby-identifier">sep</span> = <span class="ruby-value str">""</span> <span class="ruby-comment cmt"># First entry comes after = sign, but then we need commas</span>
|
|
26
|
+
<span class="ruby-identifier">val</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pval</span><span class="ruby-operator">|</span>
|
|
27
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pval</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:to_ical</span>
|
|
28
|
+
<span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sep</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">pval</span>.<span class="ruby-identifier">to_ical</span>
|
|
29
|
+
<span class="ruby-identifier">sep</span> = <span class="ruby-value str">","</span>
|
|
30
|
+
<span class="ruby-keyword kw">end</span>
|
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
|
33
|
+
<span class="ruby-keyword kw">end</span>
|
|
34
|
+
<span class="ruby-identifier">s</span>
|
|
35
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>custom_property (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 176</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">custom_property</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
|
|
15
|
+
<span class="ruby-ivar">@properties</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>
|
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>multi_property? (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 180</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multi_property?</span>(<span class="ruby-identifier">name</span>)
|
|
15
|
+
<span class="ruby-ivar">@@multi_properties</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">downcase</span>)
|
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>ical_component (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 187</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Component</span>.<span class="ruby-identifier">ical_component</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
|
|
15
|
+
<span class="ruby-identifier">hash_accessor</span> <span class="ruby-identifier">:@components</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>
|
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>ical_property (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 192</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Component</span>.<span class="ruby-identifier">ical_property</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">alias_name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">prop_name</span> = <span class="ruby-keyword kw">nil</span>)
|
|
15
|
+
<span class="ruby-identifier">property</span> = <span class="ruby-node">"#{property}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>
|
|
16
|
+
<span class="ruby-identifier">alias_name</span> = <span class="ruby-node">"#{alias_name}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">alias_name</span>.<span class="ruby-identifier">nil?</span>
|
|
17
|
+
|
|
18
|
+
<span class="ruby-comment cmt"># If a prop_name was given then we use that for the actual storage</span>
|
|
19
|
+
<span class="ruby-identifier">property</span> = <span class="ruby-node">"#{prop_name}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">prop_name</span>.<span class="ruby-identifier">nil?</span>
|
|
20
|
+
|
|
21
|
+
<span class="ruby-identifier">generate_getter</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">alias_name</span>)
|
|
22
|
+
<span class="ruby-identifier">generate_setter</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">alias_name</span>)
|
|
23
|
+
<span class="ruby-identifier">generate_query</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">alias_name</span>)
|
|
24
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>ical_multi_property (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 206</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Component</span>.<span class="ruby-identifier">ical_multi_property</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">singular</span>, <span class="ruby-identifier">plural</span>)
|
|
15
|
+
<span class="ruby-identifier">property</span> = <span class="ruby-node">"#{property}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/-/</span>, <span class="ruby-value str">'_'</span>)
|
|
16
|
+
<span class="ruby-identifier">plural</span> = <span class="ruby-node">"#{plural}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>
|
|
17
|
+
|
|
18
|
+
<span class="ruby-comment cmt"># Set this key so the parser knows to use an array for</span>
|
|
19
|
+
<span class="ruby-comment cmt"># storing this property type.</span>
|
|
20
|
+
<span class="ruby-ivar">@@multi_properties</span>[<span class="ruby-node">"#{property}"</span>] = <span class="ruby-keyword kw">true</span>
|
|
21
|
+
|
|
22
|
+
<span class="ruby-identifier">generate_multi_getter</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">plural</span>)
|
|
23
|
+
<span class="ruby-identifier">generate_multi_setter</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">plural</span>)
|
|
24
|
+
<span class="ruby-identifier">generate_multi_query</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">plural</span>)
|
|
25
|
+
<span class="ruby-identifier">generate_multi_adder</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">singular</span>)
|
|
26
|
+
<span class="ruby-identifier">generate_multi_remover</span>(<span class="ruby-identifier">property</span>, <span class="ruby-identifier">singular</span>)
|
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>respond_to? (Icalendar::Component)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/component.rb, line 408</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method_name</span>)
|
|
15
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/x_.*/</span>
|
|
16
|
+
<span class="ruby-keyword kw">super</span>
|
|
17
|
+
<span class="ruby-keyword kw">end</span>
|
|
18
|
+
|
|
19
|
+
<span class="ruby-keyword kw">true</span>
|
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -148,7 +148,8 @@ time-minute
|
|
|
148
148
|
<a name="M000013"></a>
|
|
149
149
|
|
|
150
150
|
<div class="method-heading">
|
|
151
|
-
<a href="
|
|
151
|
+
<a href="DateProp.src/M000013.html" target="Code" class="method-signature"
|
|
152
|
+
onclick="popupCode('DateProp.src/M000013.html');return false;">
|
|
152
153
|
<span class="method-name">append_features</span><span class="method-args">(base)</span>
|
|
153
154
|
</a>
|
|
154
155
|
</div>
|
|
@@ -158,17 +159,6 @@ time-minute
|
|
|
158
159
|
This method is called automatically when the module is mixed in. I guess
|
|
159
160
|
you have to do this to mixin class methods rather than instance methods.
|
|
160
161
|
</p>
|
|
161
|
-
<p><a class="source-toggle" href="#"
|
|
162
|
-
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
|
163
|
-
<div class="method-source-code" id="M000013-source">
|
|
164
|
-
<pre>
|
|
165
|
-
<span class="ruby-comment cmt"># File lib/icalendar/helpers.rb, line 30</span>
|
|
166
|
-
30: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">append_features</span>(<span class="ruby-identifier">base</span>)
|
|
167
|
-
31: <span class="ruby-keyword kw">super</span>
|
|
168
|
-
32: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ClassMethods</span>)
|
|
169
|
-
33: <span class="ruby-keyword kw">end</span>
|
|
170
|
-
</pre>
|
|
171
|
-
</div>
|
|
172
162
|
</div>
|
|
173
163
|
</div>
|
|
174
164
|
|
|
@@ -0,0 +1,19 @@
|
|
|
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>
|
|
7
|
+
<head>
|
|
8
|
+
<title>append_features (Icalendar::DateProp)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/icalendar/helpers.rb, line 30</span>
|
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">append_features</span>(<span class="ruby-identifier">base</span>)
|
|
15
|
+
<span class="ruby-keyword kw">super</span>
|
|
16
|
+
<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ClassMethods</span>)
|
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -113,70 +113,13 @@ than instance methods.
|
|
|
113
113
|
<a name="M000014"></a>
|
|
114
114
|
|
|
115
115
|
<div class="method-heading">
|
|
116
|
-
<a href="
|
|
116
|
+
<a href="ClassMethods.src/M000014.html" target="Code" class="method-signature"
|
|
117
|
+
onclick="popupCode('ClassMethods.src/M000014.html');return false;">
|
|
117
118
|
<span class="method-name">date_property</span><span class="method-args">(dp, alias_name = nil)</span>
|
|
118
119
|
</a>
|
|
119
120
|
</div>
|
|
120
121
|
|
|
121
122
|
<div class="method-description">
|
|
122
|
-
<p><a class="source-toggle" href="#"
|
|
123
|
-
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
|
124
|
-
<div class="method-source-code" id="M000014-source">
|
|
125
|
-
<pre>
|
|
126
|
-
<span class="ruby-comment cmt"># File lib/icalendar/helpers.rb, line 38</span>
|
|
127
|
-
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_property</span>(<span class="ruby-identifier">dp</span>, <span class="ruby-identifier">alias_name</span> = <span class="ruby-keyword kw">nil</span>)
|
|
128
|
-
39: <span class="ruby-identifier">dp</span> = <span class="ruby-node">"#{dp}"</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>
|
|
129
|
-
40: <span class="ruby-identifier">getter</span> = <span class="ruby-identifier">dp</span>
|
|
130
|
-
41: <span class="ruby-identifier">setter</span> = <span class="ruby-node">"#{dp}="</span>
|
|
131
|
-
42: <span class="ruby-identifier">query</span> = <span class="ruby-node">"#{dp}?"</span>
|
|
132
|
-
43:
|
|
133
|
-
44: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">instance_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">getter</span>
|
|
134
|
-
45: <span class="ruby-identifier">code</span> = <span class="ruby-value str">"def \#{getter}(*a)\nif a.empty?\n@properties[\#{dp.upcase}]\nelse\nself.\#{dp} = a.first\nend\nend\n"</span>
|
|
135
|
-
46:
|
|
136
|
-
47: <span class="ruby-identifier">module_eval</span> <span class="ruby-identifier">code</span>
|
|
137
|
-
48: <span class="ruby-keyword kw">end</span>
|
|
138
|
-
49:
|
|
139
|
-
50: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">instance_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">setter</span>
|
|
140
|
-
51: <span class="ruby-identifier">code</span> = <span class="ruby-value str">"def \#{setter} a\n@properties[\#{dp.upcase}] = a\nend\n"</span>
|
|
141
|
-
52:
|
|
142
|
-
53: <span class="ruby-identifier">module_eval</span> <span class="ruby-identifier">code</span>
|
|
143
|
-
54: <span class="ruby-keyword kw">end</span>
|
|
144
|
-
55:
|
|
145
|
-
56: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">instance_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">query</span>
|
|
146
|
-
57: <span class="ruby-identifier">code</span> = <span class="ruby-value str">"def \#{query}\n@properties.has_key?(\#{dp.upcase})\nend\n"</span>
|
|
147
|
-
58:
|
|
148
|
-
59: <span class="ruby-identifier">module_eval</span> <span class="ruby-identifier">code</span>
|
|
149
|
-
60: <span class="ruby-keyword kw">end</span>
|
|
150
|
-
61:
|
|
151
|
-
62: <span class="ruby-comment cmt"># Define the getter</span>
|
|
152
|
-
63: <span class="ruby-identifier">getter</span> = <span class="ruby-node">"get#{property.to_s.capitalize}"</span>
|
|
153
|
-
64: <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">getter</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword kw">do</span>
|
|
154
|
-
65: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"inside getting..."</span>
|
|
155
|
-
66: <span class="ruby-identifier">getDateProperty</span>(<span class="ruby-identifier">property</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>)
|
|
156
|
-
67: <span class="ruby-keyword kw">end</span>
|
|
157
|
-
68:
|
|
158
|
-
69: <span class="ruby-comment cmt"># Define the setter</span>
|
|
159
|
-
70: <span class="ruby-identifier">setter</span> = <span class="ruby-node">"set#{property.to_s.capitalize}"</span>
|
|
160
|
-
71: <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">setter</span>.<span class="ruby-identifier">to_sym</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">params</span><span class="ruby-operator">|</span>
|
|
161
|
-
72: <span class="ruby-identifier">date</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">0</span>]
|
|
162
|
-
73: <span class="ruby-identifier">utc</span> = <span class="ruby-identifier">params</span>[<span class="ruby-value">1</span>]
|
|
163
|
-
74: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"inside setting..."</span>
|
|
164
|
-
75: <span class="ruby-identifier">setDateProperty</span>(<span class="ruby-identifier">property</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>, <span class="ruby-identifier">date</span>, <span class="ruby-identifier">utc</span>)
|
|
165
|
-
76: <span class="ruby-keyword kw">end</span>
|
|
166
|
-
77:
|
|
167
|
-
78: <span class="ruby-comment cmt"># Create aliases if a name was specified</span>
|
|
168
|
-
79: <span class="ruby-comment cmt"># if not aliasName.nil?</span>
|
|
169
|
-
80: <span class="ruby-comment cmt"># gasym = "get#{aliasName.to_s.capitalize}".to_sym </span>
|
|
170
|
-
81: <span class="ruby-comment cmt"># gsym = getter.to_sym</span>
|
|
171
|
-
82: <span class="ruby-comment cmt"># alias gasym gsym </span>
|
|
172
|
-
83:
|
|
173
|
-
84: <span class="ruby-comment cmt"># sasym = "set#{aliasName.to_s.capitalize}".to_sym </span>
|
|
174
|
-
85: <span class="ruby-comment cmt"># ssym = setter.to_sym</span>
|
|
175
|
-
86: <span class="ruby-comment cmt"># alias sasym ssym </span>
|
|
176
|
-
87: <span class="ruby-comment cmt"># end</span>
|
|
177
|
-
88: <span class="ruby-keyword kw">end</span>
|
|
178
|
-
</pre>
|
|
179
|
-
</div>
|
|
180
123
|
</div>
|
|
181
124
|
</div>
|
|
182
125
|
|