richunits 0.2.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,4 +1,20 @@
1
+ === 0.5.0 / 2009-05-30
2
+
3
+ * Name of gem and main require will be 'richunits' (no underscore).
4
+
5
+ === 0.4.0 / 2008-09-09
6
+
7
+ * Rewrote Duration class and integrated into rest of system.
8
+
9
+ === 0.3.0 / 2008-09-08
10
+
11
+ * Encapsulated entire library in RichUnits module.
12
+
13
+ === 0.2.0 / 2008-08-01
14
+
15
+ * Reorganized repository.
16
+
1
17
  === 0.1.0 / 2008-03-27
2
18
 
3
- * Initial version, spun-off from Facets.
19
+ * Initial version.
4
20
 
data/COPYING ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
data/MANIFEST CHANGED
@@ -1,24 +1,40 @@
1
1
  doc
2
+ lib
3
+ meta
2
4
  test
3
- test/test_bytes.rb
4
- test/test_multipliers.rb
5
- test/test_times.rb
6
5
  CHANGES
6
+ RELEASE
7
+ TODO
7
8
  README
8
- meta
9
+ VERSION
10
+ COPYING
11
+ doc/ads
12
+ doc/index.css
13
+ doc/index.html
14
+ doc/images
15
+ doc/ads/rdoc.html
16
+ doc/images/ruby.png
17
+ doc/images/ruby-md.png
18
+ doc/images/tiger_logo.png
19
+ doc/images/ruby-sm.png
20
+ doc/images/tiger-sm.png
21
+ lib/rich_units.rb
22
+ lib/richunits
23
+ lib/richunits.rb
24
+ lib/richunits/times.rb
25
+ lib/richunits/duration.rb
26
+ lib/richunits/multipliers.rb
27
+ lib/richunits/weekdays.rb
28
+ lib/richunits/bytes.rb
9
29
  meta/created
10
30
  meta/repository
11
31
  meta/homepage
12
32
  meta/abstract
13
33
  meta/title
34
+ meta/version
14
35
  meta/license
15
36
  meta/contact
16
- lib
17
- lib/rich_units.rb
18
- lib/rich_units
19
- lib/rich_units/times.rb
20
- lib/rich_units/multipliers.rb
21
- lib/rich_units/weekdays.rb
22
- lib/rich_units/bytes.rb
23
- VERSION
24
- NEWS
37
+ test/test_duration.rb
38
+ test/test_bytes.rb
39
+ test/test_multipliers.rb
40
+ test/test_times.rb
data/README CHANGED
@@ -1,5 +1,54 @@
1
1
  = Rich Units
2
2
 
3
- Rich Kilmer's Units System
3
+ Easy Units for Ruby
4
4
 
5
+ http://richunits.rubyforge.org
6
+
7
+ == Usage
8
+
9
+ You only need to require 'rich_units' and all of RichUnit's
10
+ extensions are loaded.
11
+
12
+ require 'richunits'
13
+
14
+ 2.hours #=> 7200
15
+
16
+ RichUnits also includes a Duration class (inspired by Matthew Harris' version)
17
+ for storing time measures. These measure were originally stored as Integer
18
+ seconds. The Duration class instead stores the seconds as an attribute and
19
+ adds a an optional segements property which can be used to select exactly
20
+ how to segment up the time period (years, week, days, etc.).
21
+
22
+ See RDocs for complete API documentation.
23
+
24
+ == Development
25
+
26
+ GitHub Repository.
27
+
28
+ git://github.com/trans/richunits.git
29
+
30
+ This project uses the Reap build system.
31
+
32
+ http://reap.rubyforge.org
33
+
34
+ == TODO
35
+
36
+ * Should we rename the Rubyforge project from richunits to rich_units?
37
+
38
+ == Copying
39
+
40
+ Copyright (c) 2008 TigerOps
41
+ Copyright (c) 2006 Matthew Harris
42
+ Copyright (c) 2004 Rich Kilmer
43
+
44
+ If you have contributed to this code and feel you deserve mention
45
+ in the copyright notice, please let us know. Since this code has
46
+ been through a number of hands and other projects (Facets and
47
+ ActiveSupport among them) it is hard to identify exactly who is
48
+ responsible for what. Nonetheless, Rich Kilmer is the father of
49
+ this code so most of the rights must fall to him.
50
+
51
+ RichUnits is distributed under the terms of the MIT license.
52
+
53
+ See COPYING file.
5
54
 
data/RELEASE ADDED
@@ -0,0 +1,21 @@
1
+ This release updates some extensions to Time for use with the
2
+ Duration class, and standardizes the library on the name 'richunits',
3
+ rather than using the underscored "rich_units". This means installation
4
+ is now:
5
+
6
+ gem install richunits
7
+
8
+ and loading the library is now:
9
+
10
+ require 'richunits'
11
+
12
+ Though a backward compatible require is still present.
13
+
14
+ The previous release contains a complete rewrite of the Duration
15
+ class and integrates it into the rest of the system.
16
+
17
+
18
+ ### 0.5.0 / 2009-05-30
19
+
20
+ * Rewrote Duration class and integrated into rest of system.
21
+
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+
2
+ * Achieve 99.9% drop-in compatability with ActiveSupport.
3
+
4
+ * Better TimeZone support.
5
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- richunits 0.2.0 beta (2008-09-06)
1
+ richunits 0.5.0 beta (2009-05-30)
data/doc/ads/rdoc.html ADDED
@@ -0,0 +1,12 @@
1
+ <div style="position: absolute; top: 5px; right: 10px;">
2
+ <script type="text/javascript"><!--
3
+ google_ad_client = "pub-1126154564663472";
4
+ //BLOW 234x60
5
+ google_ad_slot = "6480217558";
6
+ google_ad_width = 234;
7
+ google_ad_height = 60;
8
+ //--></script>
9
+ <script type="text/javascript"
10
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
11
+ </script>
12
+ </div>
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/index.css ADDED
@@ -0,0 +1,179 @@
1
+ * {
2
+ padding : 0;
3
+ margin : 0;
4
+ font-family : sans-serif;
5
+ }
6
+
7
+ body {
8
+ color : black;
9
+ background : white;
10
+ text-align : center;
11
+ position : relative;
12
+ font-size : 10px;
13
+ }
14
+
15
+ p {
16
+ text-align : justify;
17
+ font-size : 12px;
18
+ color : #555;
19
+ font-weight : normal;
20
+ margin : 10px 0px 10px 0px;
21
+ line-height : 1.5em;
22
+ letter-spacing: 1px;
23
+ }
24
+
25
+ /*
26
+ p.intro {
27
+ font-size: 14px;
28
+ font-weight: normal;
29
+ letter-spacing: 1px;
30
+ }
31
+ */
32
+
33
+ a {
34
+ color: #EF0040;
35
+ }
36
+
37
+ img {
38
+ border: none;
39
+ }
40
+
41
+ pre {
42
+ font-family : monospace;
43
+ font-size : 8pt;
44
+ color : #eeeeee;
45
+ background : #1f0f0f;
46
+ margin : 10px;
47
+ font-weight : bold;
48
+ line-height : 1.5em;
49
+ padding-top : 15px;
50
+ text-align : left;
51
+ }
52
+
53
+ h1 {
54
+ font-size: 60px;
55
+ }
56
+
57
+ h2 {
58
+ font-size: 40px;
59
+ text-align: left;
60
+ margin-top: 50px;
61
+ }
62
+
63
+ h3 {
64
+ text-align: left;
65
+ margin-top: 20px;
66
+ }
67
+
68
+ td {
69
+ vertical-align: top;
70
+ }
71
+
72
+ .container {
73
+ width : 730px;
74
+ margin : 0 auto;
75
+ position : relative;
76
+ }
77
+
78
+
79
+ .aside {
80
+ float: left;
81
+ width: 164px;
82
+ padding: 20px;
83
+ margin: 40px;
84
+ text-align: center;
85
+ background: black;
86
+ border: 0px solid gray;
87
+ margin-top: 40px;
88
+ }
89
+
90
+ .aside a {
91
+ color: #EF0040;
92
+ font-weight: bold;
93
+ }
94
+
95
+ .aside p {
96
+ text-align: center;
97
+ }
98
+
99
+ .header {
100
+ padding: 70px 40px 50px 60px;
101
+ background: url(images/ruby-md.png) 500px 30px no-repeat #111111;
102
+ text-align: left;
103
+ font-weight: bold;
104
+ margin-bottom: 20px;
105
+ border: 1px solid gray;
106
+ }
107
+
108
+ .title {
109
+ color: white; font-size: 62px;
110
+ }
111
+
112
+ .subtitle {
113
+ color: white;
114
+ font-size: 16px;
115
+ }
116
+
117
+ .content {
118
+ padding: 0 0;
119
+ }
120
+
121
+ .about {
122
+ margin: 0 0 20px 0;
123
+ padding: 20px;
124
+ text-align: justify;
125
+ font-size: 20pt;
126
+ font-weight: bold;
127
+ background: #BF0020;
128
+ color: white;
129
+ border: 1px solid pink;
130
+ }
131
+
132
+ .menu {
133
+ width : 730px;
134
+ margin : 0 auto;
135
+ padding : 15px 30px;
136
+ color : orange;
137
+ font-size : 12px;
138
+ text-align : left;
139
+ }
140
+
141
+ .menu a {
142
+ font-size: 1em;
143
+ font-weight: bold;
144
+ color: red;
145
+ text-decoration: none;
146
+ }
147
+
148
+ .menu a:hover {
149
+ text-decoration: underline;
150
+ }
151
+
152
+ .ad {
153
+ border : 0px solid white;
154
+ text-align : center;
155
+ }
156
+
157
+ .invert {
158
+ text-align : left;
159
+ color : white;
160
+ margin : 0;
161
+ padding : 15px 15px 15px 15px;
162
+ background : black;
163
+ }
164
+
165
+ .invert p {
166
+ text-align : left;
167
+ color : white;
168
+ }
169
+
170
+ .copyright {
171
+ padding : 5px;
172
+ text-align : center;
173
+ color : gray;
174
+ font-size : 1.2em;
175
+ border : 1px solid gray;
176
+ background : #111111;
177
+ margin : 20px 1px;
178
+ }
179
+
data/doc/index.html ADDED
@@ -0,0 +1,163 @@
1
+
2
+ <html>
3
+
4
+ <head>
5
+ <title>Rich Units</title>
6
+
7
+ <link href="index.css" rel="stylesheet" type="text/css"/>
8
+ <link href="images/ruby-sm.png" rel="icon"/>
9
+
10
+ <META NAME="DESCRIPTION" CONTENT="Rich Units system for the Ruby programming lanaguage.">
11
+ <META NAME="KEYWORDS" CONTENT="units, ruby, numeric, time">
12
+ </head>
13
+
14
+ <body>
15
+
16
+ <div class="menu">
17
+ <div style="float: right; font-weight: bold;">A <a href="http://tigerops.org">TigerOps</a> PROJECT</div>
18
+ <!-- &lt;<a href="http://tigerops.rubyforge.org/">Homepage</a>&gt; -->
19
+ <a href="rdoc/index.html">Documentation</a> &middot;
20
+ <a href="http://rubyforge.org/frs/?group_id=7034">Download</a> &middot;
21
+ <a href="http://rubyforge.org/projects/richunits">Development</a>
22
+ </div>
23
+
24
+ <div class="container">
25
+
26
+ <div class="header">
27
+ <span class="title">Rich Units</span>
28
+ </div>
29
+
30
+ <div class="content">
31
+
32
+ <p class="about">
33
+ RichUnits is a very easy to use unit system for the Ruby programming language.
34
+ It is essentially the same system popularized by Ruby on Rails.
35
+ </p>
36
+
37
+ <h2>Introduction</h2>
38
+
39
+ <p class="intro">Rich Units is a straight-forward units system based-on the original time
40
+ units work by Rich Kilmer (circa 2002-2004). Rich Units extends core Ruby with conveneice
41
+ methods for dealing with measures. The methods work by converting those measures to a low
42
+ common denominator; for instance all durations are stored in seconds.
43
+ </p>
44
+
45
+ <p class="intro">Rich Units provides essentially the same unit system used by
46
+ <a href="http://www.rubyonrails.org/">Ruby on Rails</a>*. But Rich Units seeks to imporve
47
+ upon this code, and provides a superset of functionality, partly derived from the
48
+ <a href="facets.rubyforge.org">Ruby Facets</a> distribution of the same libraries.
49
+ Ultimately Rich Units intent is to provide a better system than either of these large
50
+ projects can provide, by virture of a dedicated development track.
51
+ </p>
52
+
53
+ <p><span style="font-size:0.8em;"> *with the present exception of the timezone extensions (coming soon).</span></p>
54
+
55
+ <h2>Examples</h2>
56
+
57
+ <p>
58
+ Primarily Rich Units extends Numeric.
59
+ Here are some basic examples:
60
+ </p>
61
+
62
+ <pre>
63
+ require 'rich_units'
64
+
65
+ 4.days.hence #=> Tue Apr 01 08:04:17 -0400 2008
66
+ 4.hours.ago #=> Thu Mar 27 22:03:33 -0400 2008
67
+
68
+ 10.bytes #=> 80
69
+ </pre>
70
+
71
+ <p>Rich Units also extends Time.</p>
72
+
73
+ <pre>
74
+ require 'rich_units'
75
+
76
+ Time.now #=> Fri Mar 28 08:10:40 -0400 2008
77
+ Time.now.years_hence(4) #=> Wed Mar 28 08:10:47 -0400 2012
78
+ </pre>
79
+
80
+
81
+ <h2>Installation</h2>
82
+
83
+ <p>
84
+ Installing the RubyGem is of course straight forward.
85
+ </p>
86
+
87
+ <pre>
88
+ $ sudo gem install rich_units
89
+ </pre>
90
+
91
+ <p>
92
+ Manual site_ruby installation is provided via <a href="http://setup.rubyforge.org">Ruby Setup</a>.
93
+ </p>
94
+
95
+ <pre>
96
+ $ tar -xvzf rich_units-0.4.0.tgz
97
+ $ cd rich_units-0.4.0
98
+ $ sudo setup.rb all
99
+ </pre>
100
+
101
+
102
+ <h2>Development</h2>
103
+
104
+ <p>You can use gitweb to browse the 'richunits' repository.</p>
105
+
106
+ <h3>Anonymous Repository Access</h3>
107
+
108
+ <p>To pull the 'richunits' repository anonymously, use:</p>
109
+
110
+ <pre>
111
+ git clone git://rubyforge.org/richunits.git
112
+ </pre>
113
+
114
+ <h3>Master Developer Repository Access</h3>
115
+
116
+ <p>Developers: You can push to the 'richunits' repository using:</p>
117
+
118
+ <pre>
119
+ gitosis@rubyforge.org:richunits.git
120
+ </pre>
121
+
122
+ <p>Only project developers have access to this repository.
123
+ Please contact <b>transfire at gmail.com</b> if you'd like to join the development team.
124
+ </p>
125
+
126
+ <h3>Contributor Repository Access</h3>
127
+
128
+ <p>This project is also hosted on GitHub at</p>
129
+
130
+ <pre>
131
+ http://github.com/trans/richunits/tree/master
132
+ </pre>
133
+ </div>
134
+
135
+ <br/><br/>
136
+
137
+ <div style="text-align: center; padding: 20px 0; border-top: 1px solid #ccc;">
138
+ <script type="text/javascript"><!--
139
+ google_ad_client = "pub-1126154564663472";
140
+ /* TIGER 728x90 10/28/08 */
141
+ google_ad_slot = "2386645975";
142
+ google_ad_width = 728;
143
+ google_ad_height = 90;
144
+ //-->
145
+ </script>
146
+ <script type="text/javascript"
147
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
148
+ </script>
149
+ <!-- <iframe src="http://tigerops.org/assets/adverts/banner-900-1.html" scrolling="no"></frame> -->
150
+ </div>
151
+
152
+ <div class="copyright">
153
+ <br/><br/>
154
+ <span style="color: #EF0040;">Rich Units</span> Copyright (c) 2007, 2008 <a href="http://tigerops.org">Tiger Ops</a>
155
+ <br/><br/>
156
+ Rich Units is distributed under the terms of the MIT license. <br/>
157
+ <br/><br/>
158
+ </div>
159
+
160
+ </div>
161
+
162
+ </body>
163
+ </html>