runt 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +153 -125
- data/LICENSE.txt +43 -43
- data/README +106 -100
- data/Rakefile +122 -122
- data/TODO +13 -13
- data/doc/tutorial_schedule.rdoc +393 -393
- data/doc/tutorial_sugar.rdoc +143 -0
- data/doc/tutorial_te.rdoc +190 -190
- data/examples/payment_report.rb +59 -0
- data/examples/payment_reporttest.rb +49 -0
- data/examples/reminder.rb +63 -63
- data/lib/runt.rb +237 -219
- data/lib/runt/daterange.rb +74 -74
- data/lib/runt/dprecision.rb +150 -141
- data/lib/runt/expressionbuilder.rb +65 -0
- data/lib/runt/pdate.rb +165 -153
- data/lib/runt/schedule.rb +88 -88
- data/lib/runt/sugar.rb +171 -0
- data/lib/runt/temporalexpression.rb +789 -777
- data/setup.rb +1331 -1331
- data/site/blue-robot3.css +131 -131
- data/site/dcl-small.gif +0 -0
- data/site/index.html +72 -94
- data/site/runt-logo.gif +0 -0
- data/site/runt-logo.psd +0 -0
- data/test/aftertetest.rb +31 -0
- data/test/beforetetest.rb +31 -0
- data/test/daterangetest.rb +89 -89
- data/test/dprecisiontest.rb +58 -55
- data/test/expressionbuildertest.rb +64 -0
- data/test/icalendartest.rb +621 -41
- data/test/pdatetest.rb +147 -117
- data/test/redaytest.rb +10 -0
- data/test/reyeartest.rb +99 -98
- data/test/runttest.rb +98 -101
- data/test/scheduletest.rb +148 -148
- data/test/sugartest.rb +104 -0
- data/test/temporalexpressiontest.rb +76 -76
- metadata +112 -95
data/site/blue-robot3.css
CHANGED
@@ -1,132 +1,132 @@
|
|
1
|
-
|
2
|
-
body {
|
3
|
-
color:#333;
|
4
|
-
background-color:#CCCCCC;
|
5
|
-
margin:20px;
|
6
|
-
padding:0px;
|
7
|
-
font:11px verdana, arial, helvetica, sans-serif;
|
8
|
-
}
|
9
|
-
h1 {
|
10
|
-
margin:0px 0px 15px 0px;
|
11
|
-
padding:0px;
|
12
|
-
font-size:14px;
|
13
|
-
font-weight:900;
|
14
|
-
color:#ccc;
|
15
|
-
}
|
16
|
-
h2 {
|
17
|
-
font:bold 12px/14px verdana, arial, helvetica, sans-serif;
|
18
|
-
margin:0px 0px 5px 0px;
|
19
|
-
padding:0px;
|
20
|
-
}
|
21
|
-
p {
|
22
|
-
font:11px/20px verdana, arial, helvetica, sans-serif;
|
23
|
-
margin:0px 0px 16px 0px;
|
24
|
-
padding:0px;
|
25
|
-
}
|
26
|
-
.Content>p {margin:0px;}
|
27
|
-
.Content>p+p {text-indent:30px;}
|
28
|
-
|
29
|
-
a {
|
30
|
-
color:#09c;
|
31
|
-
font-size:11px;
|
32
|
-
font-family:verdana, arial, helvetica, sans-serif;
|
33
|
-
font-weight:600;
|
34
|
-
text-decoration:none;
|
35
|
-
}
|
36
|
-
a:link {color:#09c;}
|
37
|
-
a:visited {color:#07a;}
|
38
|
-
a:hover {background-color:#eee;}
|
39
|
-
|
40
|
-
|
41
|
-
/* All the content boxes belong to the content class. */
|
42
|
-
.content {
|
43
|
-
position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
|
44
|
-
width:auto;
|
45
|
-
min-width:120px;
|
46
|
-
margin:0px 210px 20px 170px;
|
47
|
-
border:1px solid black;
|
48
|
-
background-color:white;
|
49
|
-
padding:10px;
|
50
|
-
z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
|
51
|
-
}
|
52
|
-
|
53
|
-
/* 2004-03-12 MSL */
|
54
|
-
.ruby-link {
|
55
|
-
color: rgb(255, 0, 0);
|
56
|
-
}
|
57
|
-
|
58
|
-
.keyword {
|
59
|
-
font-weight:bold;
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
#navAlpha {
|
64
|
-
position:absolute;
|
65
|
-
width:150px;
|
66
|
-
top:20px;
|
67
|
-
left:20px;
|
68
|
-
border:1px dashed black;
|
69
|
-
background-color:#eee;
|
70
|
-
padding:10px;
|
71
|
-
z-index:2;
|
72
|
-
|
73
|
-
/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
|
74
|
-
Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
|
75
|
-
IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style
|
76
|
-
declaration. The incorrect IE5/Win value is above, while the correct value is
|
77
|
-
below. See http://glish.com/css/hacks.asp for details. */
|
78
|
-
voice-family: "\"}\"";
|
79
|
-
voice-family:inherit;
|
80
|
-
width:128px;
|
81
|
-
}
|
82
|
-
/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
|
83
|
-
length values to user agents that exhibit the parsing error exploited above yet get
|
84
|
-
the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
|
85
|
-
a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
|
86
|
-
body>#navAlpha {width:128px;}
|
87
|
-
|
88
|
-
#navBeta {
|
89
|
-
position:absolute;
|
90
|
-
width:190px;
|
91
|
-
top:20px;
|
92
|
-
right:20px;
|
93
|
-
border:1px dashed black;
|
94
|
-
background-color:#eee;
|
95
|
-
padding:10px;
|
96
|
-
z-index:1;
|
97
|
-
/* Again, the ugly brilliant hack. */
|
98
|
-
voice-family: "\"}\"";
|
99
|
-
voice-family:inherit;
|
100
|
-
width:168px;
|
101
|
-
}
|
102
|
-
/* Again, "be nice to Opera 5". */
|
103
|
-
body>#navBeta {width:168px;}
|
104
|
-
|
105
|
-
/* 2004-03-12 MSL */
|
106
|
-
|
107
|
-
#contentFooter {
|
108
|
-
text-align: center;
|
109
|
-
font-size:10px;
|
110
|
-
}
|
111
|
-
|
112
|
-
#contentFooter a {
|
113
|
-
font-size:10px;
|
114
|
-
}
|
115
|
-
|
116
|
-
|
117
|
-
#logo {
|
118
|
-
border: 0px solid ;
|
119
|
-
width: 97px;
|
120
|
-
height: 33px;
|
121
|
-
vertical-align: -50%;
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
#dcl-logo {
|
126
|
-
border: 0px solid ;
|
127
|
-
width: 140px;
|
128
|
-
height: 29px;
|
129
|
-
vertical-align: -110%;
|
130
|
-
margin: 2px;
|
131
|
-
}
|
1
|
+
|
2
|
+
body {
|
3
|
+
color:#333;
|
4
|
+
background-color:#CCCCCC;
|
5
|
+
margin:20px;
|
6
|
+
padding:0px;
|
7
|
+
font:11px verdana, arial, helvetica, sans-serif;
|
8
|
+
}
|
9
|
+
h1 {
|
10
|
+
margin:0px 0px 15px 0px;
|
11
|
+
padding:0px;
|
12
|
+
font-size:14px;
|
13
|
+
font-weight:900;
|
14
|
+
color:#ccc;
|
15
|
+
}
|
16
|
+
h2 {
|
17
|
+
font:bold 12px/14px verdana, arial, helvetica, sans-serif;
|
18
|
+
margin:0px 0px 5px 0px;
|
19
|
+
padding:0px;
|
20
|
+
}
|
21
|
+
p {
|
22
|
+
font:11px/20px verdana, arial, helvetica, sans-serif;
|
23
|
+
margin:0px 0px 16px 0px;
|
24
|
+
padding:0px;
|
25
|
+
}
|
26
|
+
.Content>p {margin:0px;}
|
27
|
+
.Content>p+p {text-indent:30px;}
|
28
|
+
|
29
|
+
a {
|
30
|
+
color:#09c;
|
31
|
+
font-size:11px;
|
32
|
+
font-family:verdana, arial, helvetica, sans-serif;
|
33
|
+
font-weight:600;
|
34
|
+
text-decoration:none;
|
35
|
+
}
|
36
|
+
a:link {color:#09c;}
|
37
|
+
a:visited {color:#07a;}
|
38
|
+
a:hover {background-color:#eee;}
|
39
|
+
|
40
|
+
|
41
|
+
/* All the content boxes belong to the content class. */
|
42
|
+
.content {
|
43
|
+
position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
|
44
|
+
width:auto;
|
45
|
+
min-width:120px;
|
46
|
+
margin:0px 210px 20px 170px;
|
47
|
+
border:1px solid black;
|
48
|
+
background-color:white;
|
49
|
+
padding:10px;
|
50
|
+
z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
|
51
|
+
}
|
52
|
+
|
53
|
+
/* 2004-03-12 MSL */
|
54
|
+
.ruby-link {
|
55
|
+
color: rgb(255, 0, 0);
|
56
|
+
}
|
57
|
+
|
58
|
+
.keyword {
|
59
|
+
font-weight:bold;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
#navAlpha {
|
64
|
+
position:absolute;
|
65
|
+
width:150px;
|
66
|
+
top:20px;
|
67
|
+
left:20px;
|
68
|
+
border:1px dashed black;
|
69
|
+
background-color:#eee;
|
70
|
+
padding:10px;
|
71
|
+
z-index:2;
|
72
|
+
|
73
|
+
/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
|
74
|
+
Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
|
75
|
+
IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style
|
76
|
+
declaration. The incorrect IE5/Win value is above, while the correct value is
|
77
|
+
below. See http://glish.com/css/hacks.asp for details. */
|
78
|
+
voice-family: "\"}\"";
|
79
|
+
voice-family:inherit;
|
80
|
+
width:128px;
|
81
|
+
}
|
82
|
+
/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
|
83
|
+
length values to user agents that exhibit the parsing error exploited above yet get
|
84
|
+
the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
|
85
|
+
a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
|
86
|
+
body>#navAlpha {width:128px;}
|
87
|
+
|
88
|
+
#navBeta {
|
89
|
+
position:absolute;
|
90
|
+
width:190px;
|
91
|
+
top:20px;
|
92
|
+
right:20px;
|
93
|
+
border:1px dashed black;
|
94
|
+
background-color:#eee;
|
95
|
+
padding:10px;
|
96
|
+
z-index:1;
|
97
|
+
/* Again, the ugly brilliant hack. */
|
98
|
+
voice-family: "\"}\"";
|
99
|
+
voice-family:inherit;
|
100
|
+
width:168px;
|
101
|
+
}
|
102
|
+
/* Again, "be nice to Opera 5". */
|
103
|
+
body>#navBeta {width:168px;}
|
104
|
+
|
105
|
+
/* 2004-03-12 MSL */
|
106
|
+
|
107
|
+
#contentFooter {
|
108
|
+
text-align: center;
|
109
|
+
font-size:10px;
|
110
|
+
}
|
111
|
+
|
112
|
+
#contentFooter a {
|
113
|
+
font-size:10px;
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
#logo {
|
118
|
+
border: 0px solid ;
|
119
|
+
width: 97px;
|
120
|
+
height: 33px;
|
121
|
+
vertical-align: -50%;
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
#dcl-logo {
|
126
|
+
border: 0px solid ;
|
127
|
+
width: 140px;
|
128
|
+
height: 29px;
|
129
|
+
vertical-align: -110%;
|
130
|
+
margin: 2px;
|
131
|
+
}
|
132
132
|
|
data/site/dcl-small.gif
CHANGED
File without changes
|
data/site/index.html
CHANGED
@@ -1,94 +1,72 @@
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
-
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
-
|
4
|
-
<html>
|
5
|
-
<head>
|
6
|
-
<title>Runt - Ruby Temporal Expressions</title>
|
7
|
-
<style type="text/css" media="screen">@import "blue-robot3.css";</style>
|
8
|
-
|
9
|
-
</head>
|
10
|
-
|
11
|
-
<body>
|
12
|
-
|
13
|
-
<div class="content">
|
14
|
-
<h1><a href="http://runt.rubyforge.org"><img id="logo" src="runt-logo.gif" title="Choose your own damn acronym" alt="runt logo"></a>Ruby Temporal Expressions</h1>
|
15
|
-
<p><span class="keyword">Runt</span> is an implementation of select temporal patterns by <a href="http://www.martinfowler.com">Martin Fowler</a> in the super-fantastic <a href="http://ruby-lang.org"><span class="ruby-link">Ruby</span></a> language.
|
16
|
-
<span class="keyword">Runt</span> provides:
|
17
|
-
<ul>
|
18
|
-
<li>ability to define recurring events using simple, set-like expressions</li>
|
19
|
-
<li>an interfaced-based API for creating schedules for arbitrary events/objects</li>
|
20
|
-
<li>precisioned date types using <a href="http://martinfowler.com/ap2/timePoint.html">Time Point</a>s</li>
|
21
|
-
<li>date <a href="http://martinfowler.com/ap2/range.html">Range</a>s</li>
|
22
|
-
<li>everlasting peace and/or eternal life</li>
|
23
|
-
</ul>
|
24
|
-
</p>
|
25
|
-
<p>Visit our <a href="http://rubyforge.org/projects/runt/">project page</a> provided by the generous folks at <a href="http://rubyforge.org">Rubyforge</a>.</p>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div class="content">
|
29
|
-
|
30
|
-
<h2>
|
31
|
-
<p>
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
</
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
</
|
51
|
-
<
|
52
|
-
|
53
|
-
<
|
54
|
-
|
55
|
-
</p>
|
56
|
-
</div>
|
57
|
-
|
58
|
-
<div id="
|
59
|
-
<
|
60
|
-
<
|
61
|
-
|
62
|
-
|
63
|
-
<
|
64
|
-
<
|
65
|
-
<
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<a href="http://ChronicJ.org/" title="ChronicJ project">ChronicJ</a><br>
|
74
|
-
</p>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
<div id="navBeta">
|
78
|
-
<h2>Suggested Reading</h2>
|
79
|
-
<p>Most of the usage and design patterns contained in this library are based on a series of articles by Martin Fowler. Some suggested reading:</p>
|
80
|
-
<p>
|
81
|
-
<a href="http://martinfowler.com/ap2/timeNarrative.html">Time Narrative</a><br/>
|
82
|
-
<a href="http://martinfowler.com/apsupp/recurring.pdf">Recurring Events</a><br/>
|
83
|
-
<a href="http://martinfowler.com/ap2/timePoint.html">Time Point</a><br/>
|
84
|
-
<a href="http://martinfowler.com/ap2/range.html">Range</a><br/>
|
85
|
-
----<br/>
|
86
|
-
<p><span class="keyword">Runt</span> was originally hacked in Java. Documentation for that project may also be helpful:</p>
|
87
|
-
<a href="http://www.chronicj.org/apidocs/index.html" title="ChronicJ project">ChronicJ JavaDocs</a><br>
|
88
|
-
</p>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<!-- BlueRobot was here. -->
|
92
|
-
|
93
|
-
</body>
|
94
|
-
</html>
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
|
4
|
+
<html>
|
5
|
+
<head>
|
6
|
+
<title>Runt - Ruby Temporal Expressions</title>
|
7
|
+
<style type="text/css" media="screen">@import "blue-robot3.css";</style>
|
8
|
+
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<div class="content">
|
14
|
+
<h1><a href="http://runt.rubyforge.org"><img id="logo" src="runt-logo.gif" title="Choose your own damn acronym" alt="runt logo"></a>Ruby Temporal Expressions</h1>
|
15
|
+
<p><span class="keyword">Runt</span> is an implementation of select temporal patterns by <a href="http://www.martinfowler.com">Martin Fowler</a> in the super-fantastic <a href="http://ruby-lang.org"><span class="ruby-link">Ruby</span></a> language.
|
16
|
+
<span class="keyword">Runt</span> provides:
|
17
|
+
<ul>
|
18
|
+
<li>ability to define recurring events using simple, set-like expressions</li>
|
19
|
+
<li>an interfaced-based API for creating schedules for arbitrary events/objects</li>
|
20
|
+
<li>precisioned date types using <a href="http://martinfowler.com/ap2/timePoint.html">Time Point</a>s</li>
|
21
|
+
<li>date <a href="http://martinfowler.com/ap2/range.html">Range</a>s</li>
|
22
|
+
<li>everlasting peace and/or eternal life</li>
|
23
|
+
</ul>
|
24
|
+
</p>
|
25
|
+
<p>Visit our <a href="http://rubyforge.org/projects/runt/">project page</a> provided by the generous folks at <a href="http://rubyforge.org">Rubyforge</a>.</p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="content">
|
29
|
+
|
30
|
+
<h2>Getting Started</h2>
|
31
|
+
<p>
|
32
|
+
Check out the <a href="./doc/files/doc/tutorial_te_rdoc.html" title="TE Tutorial">temporal expressions tutorial</a>. Then try
|
33
|
+
<a href="./doc/files/doc/tutorial_schedule_rdoc.html" title="Schedule Tutorial">schedule tutorial</a> and finally,
|
34
|
+
<a href="./doc/files/doc/tutorial_sugar_rdoc.html" title="Sugar Tutorial">sugar tutorial</a> for some useful shortcuts.
|
35
|
+
</p>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="contentFooter" class="content">
|
39
|
+
<a href="http://www.digitalclash.com"><<<img id="dcl-logo" src="dcl-small.gif" title="Digital Clash LLC" alt="Digital Clash logo">©2008, Digital Clash LLC>></a>
|
40
|
+
<br/><i>"The weather is here, wish you were beautiful..."</i>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="navAlpha">
|
44
|
+
<h2>Links</h2>
|
45
|
+
<p>
|
46
|
+
<a href="http://rubyforge.org/projects/runt/" title="Download Runt">Download</a><br>
|
47
|
+
----<br/>
|
48
|
+
<a href="./doc/index.html" title="RDoc for Runt">RDocs</a><br>
|
49
|
+
<a href="./doc/files/doc/tutorial_te_rdoc.html" title="TE Tutorial">Expression Tutorial</a><br>
|
50
|
+
<a href="./doc/files/doc/tutorial_schedule_rdoc.html" title="Schedule Tutorial">Schedule Tutorial</a><br>
|
51
|
+
<a href="./doc/files/doc/tutorial_sugar_rdoc.html" title="Sugar Tutorial">Sugar Tutorial</a><br>
|
52
|
+
----<br/>
|
53
|
+
<a href="./doc/files/README.html">README</a><br/>
|
54
|
+
<a href="./doc/files/CHANGES.html">CHANGES</a><br/>
|
55
|
+
</p>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div id="navBeta">
|
59
|
+
<h2>Suggested Reading</h2>
|
60
|
+
<p>Most of the usage and design patterns contained in this library are based on a series of articles by Martin Fowler. Some suggested reading:</p>
|
61
|
+
<p>
|
62
|
+
<a href="http://martinfowler.com/ap2/timeNarrative.html">Time Narrative</a><br/>
|
63
|
+
<a href="http://martinfowler.com/apsupp/recurring.pdf">Recurring Events</a><br/>
|
64
|
+
<a href="http://martinfowler.com/ap2/timePoint.html">Time Point</a><br/>
|
65
|
+
<a href="http://martinfowler.com/ap2/range.html">Range</a><br/>
|
66
|
+
</p>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<!-- BlueRobot was here. -->
|
70
|
+
|
71
|
+
</body>
|
72
|
+
</html>
|
data/site/runt-logo.gif
CHANGED
File without changes
|
data/site/runt-logo.psd
CHANGED
Binary file
|
data/test/aftertetest.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'baseexpressiontest'
|
4
|
+
|
5
|
+
# Unit tests for AfterTE class
|
6
|
+
# Author:: Matthew Lipper
|
7
|
+
|
8
|
+
class AfterTETest < BaseExpressionTest
|
9
|
+
|
10
|
+
include TExpr
|
11
|
+
|
12
|
+
def test_include_inclusive
|
13
|
+
expr = AfterTE.new(@pdate_20071030, true)
|
14
|
+
assert !expr.include?(@date_20050101), "Should not include an earlier date"
|
15
|
+
assert expr.include?(@pdate_20071114), "Should include a later date"
|
16
|
+
assert expr.include?(@pdate_20071030), "Should include the same date"
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_include_non_inclusive
|
20
|
+
expr = AfterTE.new(@pdate_20071030)
|
21
|
+
assert !expr.include?(@date_20050101), "Should not include an earlier date"
|
22
|
+
assert expr.include?(@pdate_20071114), "Should include a later date"
|
23
|
+
assert !expr.include?(@pdate_20071030), "Should not include the same date"
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_to_s
|
27
|
+
expr = AfterTE.new(@pdate_20071114)
|
28
|
+
assert_equal "after #{Runt.format_date(@pdate_20071114)}", expr.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|