stick 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,10 @@
1
1
  = Stick Change History
2
2
 
3
+ == 1.3.0 / 2007-12-21
4
+
5
+ * Removed times.rb. WE can reconsider this type of functionaility later.
6
+ * Decided to distribute under the MIT License.
7
+
3
8
  == 1.2.0 / 2007-12-14
4
9
 
5
10
  * Initial release as Stick.
data/COPYING CHANGED
@@ -1,344 +1,8 @@
1
+ The MIT License
1
2
 
2
- THE RUBY LICENSE
3
- (http://www.ruby-lang.org/en/LICENSE.txt)
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
5
- You may redistribute this software and/or modify it under either the terms of
6
- the GPL (see below), or the conditions below:
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
6
 
8
- 1. You may make and give away verbatim copies of the source form of the
9
- software without restriction, provided that you duplicate all of the
10
- original copyright notices and associated disclaimers.
11
-
12
- 2. You may modify your copy of the software in any way, provided that
13
- you do at least ONE of the following:
14
-
15
- a) place your modifications in the Public Domain or otherwise
16
- make them Freely Available, such as by posting said
17
- modifications to Usenet or an equivalent medium, or by allowing
18
- the author to include your modifications in the software.
19
-
20
- b) use the modified software only within your corporation or
21
- organization.
22
-
23
- c) rename any non-standard executables so the names do not conflict
24
- with standard executables, which must also be provided.
25
-
26
- d) make other distribution arrangements with the author.
27
-
28
- 3. You may distribute the software in object code or executable
29
- form, provided that you do at least ONE of the following:
30
-
31
- a) distribute the executables and library files of the software,
32
- together with instructions (in the manual page or equivalent)
33
- on where to get the original distribution.
34
-
35
- b) accompany the distribution with the machine-readable source of
36
- the software.
37
-
38
- c) give non-standard executables non-standard names, with
39
- instructions on where to get the original software distribution.
40
-
41
- d) make other distribution arrangements with the author.
42
-
43
- 4. You may modify and include the part of the software into any other
44
- software (possibly commercial). But some files in the distribution
45
- are not written by the author, so that they are not under these terms.
46
-
47
- For the list of those files and their copying conditions, see the
48
- file LEGAL.
49
-
50
- 5. The scripts and library files supplied as input to or produced as
51
- output from the software do not automatically fall under the
52
- copyright of the software, but belong to whomever generated them,
53
- and may be sold commercially, and may be aggregated with this
54
- software.
55
-
56
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
- PURPOSE.
60
-
61
- ----------------------------------------------------------------------------
62
-
63
-
64
- GNU GENERAL PUBLIC LICENSE
65
- Version 2, June 1991
66
-
67
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
68
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
69
- Everyone is permitted to copy and distribute verbatim copies
70
- of this license document, but changing it is not allowed.
71
-
72
- Preamble
73
-
74
- The licenses for most software are designed to take away your
75
- freedom to share and change it. By contrast, the GNU General Public
76
- License is intended to guarantee your freedom to share and change free
77
- software--to make sure the software is free for all its users. This
78
- General Public License applies to most of the Free Software
79
- Foundation's software and to any other program whose authors commit to
80
- using it. (Some other Free Software Foundation software is covered by
81
- the GNU Library General Public License instead.) You can apply it to
82
- your programs, too.
83
-
84
- When we speak of free software, we are referring to freedom, not
85
- price. Our General Public Licenses are designed to make sure that you
86
- have the freedom to distribute copies of free software (and charge for
87
- this service if you wish), that you receive source code or can get it
88
- if you want it, that you can change the software or use pieces of it
89
- in new free programs; and that you know you can do these things.
90
-
91
- To protect your rights, we need to make restrictions that forbid
92
- anyone to deny you these rights or to ask you to surrender the rights.
93
- These restrictions translate to certain responsibilities for you if you
94
- distribute copies of the software, or if you modify it.
95
-
96
- For example, if you distribute copies of such a program, whether
97
- gratis or for a fee, you must give the recipients all the rights that
98
- you have. You must make sure that they, too, receive or can get the
99
- source code. And you must show them these terms so they know their
100
- rights.
101
-
102
- We protect your rights with two steps: (1) copyright the software, and
103
- (2) offer you this license which gives you legal permission to copy,
104
- distribute and/or modify the software.
105
-
106
- Also, for each author's protection and ours, we want to make certain
107
- that everyone understands that there is no warranty for this free
108
- software. If the software is modified by someone else and passed on, we
109
- want its recipients to know that what they have is not the original, so
110
- that any problems introduced by others will not reflect on the original
111
- authors' reputations.
112
-
113
- Finally, any free program is threatened constantly by software
114
- patents. We wish to avoid the danger that redistributors of a free
115
- program will individually obtain patent licenses, in effect making the
116
- program proprietary. To prevent this, we have made it clear that any
117
- patent must be licensed for everyone's free use or not licensed at all.
118
-
119
- The precise terms and conditions for copying, distribution and
120
- modification follow.
121
-
122
- GNU GENERAL PUBLIC LICENSE
123
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
124
-
125
- 0. This License applies to any program or other work which contains
126
- a notice placed by the copyright holder saying it may be distributed
127
- under the terms of this General Public License. The "Program", below,
128
- refers to any such program or work, and a "work based on the Program"
129
- means either the Program or any derivative work under copyright law:
130
- that is to say, a work containing the Program or a portion of it,
131
- either verbatim or with modifications and/or translated into another
132
- language. (Hereinafter, translation is included without limitation in
133
- the term "modification".) Each licensee is addressed as "you".
134
-
135
- Activities other than copying, distribution and modification are not
136
- covered by this License; they are outside its scope. The act of
137
- running the Program is not restricted, and the output from the Program
138
- is covered only if its contents constitute a work based on the
139
- Program (independent of having been made by running the Program).
140
- Whether that is true depends on what the Program does.
141
-
142
- 1. You may copy and distribute verbatim copies of the Program's
143
- source code as you receive it, in any medium, provided that you
144
- conspicuously and appropriately publish on each copy an appropriate
145
- copyright notice and disclaimer of warranty; keep intact all the
146
- notices that refer to this License and to the absence of any warranty;
147
- and give any other recipients of the Program a copy of this License
148
- along with the Program.
149
-
150
- You may charge a fee for the physical act of transferring a copy, and
151
- you may at your option offer warranty protection in exchange for a fee.
152
-
153
- 2. You may modify your copy or copies of the Program or any portion
154
- of it, thus forming a work based on the Program, and copy and
155
- distribute such modifications or work under the terms of Section 1
156
- above, provided that you also meet all of these conditions:
157
-
158
- a) You must cause the modified files to carry prominent notices
159
- stating that you changed the files and the date of any change.
160
-
161
- b) You must cause any work that you distribute or publish, that in
162
- whole or in part contains or is derived from the Program or any
163
- part thereof, to be licensed as a whole at no charge to all third
164
- parties under the terms of this License.
165
-
166
- c) If the modified program normally reads commands interactively
167
- when run, you must cause it, when started running for such
168
- interactive use in the most ordinary way, to print or display an
169
- announcement including an appropriate copyright notice and a
170
- notice that there is no warranty (or else, saying that you provide
171
- a warranty) and that users may redistribute the program under
172
- these conditions, and telling the user how to view a copy of this
173
- License. (Exception: if the Program itself is interactive but
174
- does not normally print such an announcement, your work based on
175
- the Program is not required to print an announcement.)
176
-
177
- These requirements apply to the modified work as a whole. If
178
- identifiable sections of that work are not derived from the Program,
179
- and can be reasonably considered independent and separate works in
180
- themselves, then this License, and its terms, do not apply to those
181
- sections when you distribute them as separate works. But when you
182
- distribute the same sections as part of a whole which is a work based
183
- on the Program, the distribution of the whole must be on the terms of
184
- this License, whose permissions for other licensees extend to the
185
- entire whole, and thus to each and every part regardless of who wrote it.
186
-
187
- Thus, it is not the intent of this section to claim rights or contest
188
- your rights to work written entirely by you; rather, the intent is to
189
- exercise the right to control the distribution of derivative or
190
- collective works based on the Program.
191
-
192
- In addition, mere aggregation of another work not based on the Program
193
- with the Program (or with a work based on the Program) on a volume of
194
- a storage or distribution medium does not bring the other work under
195
- the scope of this License.
196
-
197
- 3. You may copy and distribute the Program (or a work based on it,
198
- under Section 2) in object code or executable form under the terms of
199
- Sections 1 and 2 above provided that you also do one of the following:
200
-
201
- a) Accompany it with the complete corresponding machine-readable
202
- source code, which must be distributed under the terms of Sections
203
- 1 and 2 above on a medium customarily used for software interchange; or,
204
-
205
- b) Accompany it with a written offer, valid for at least three
206
- years, to give any third party, for a charge no more than your
207
- cost of physically performing source distribution, a complete
208
- machine-readable copy of the corresponding source code, to be
209
- distributed under the terms of Sections 1 and 2 above on a medium
210
- customarily used for software interchange; or,
211
-
212
- c) Accompany it with the information you received as to the offer
213
- to distribute corresponding source code. (This alternative is
214
- allowed only for noncommercial distribution and only if you
215
- received the program in object code or executable form with such
216
- an offer, in accord with Subsection b above.)
217
-
218
- The source code for a work means the preferred form of the work for
219
- making modifications to it. For an executable work, complete source
220
- code means all the source code for all modules it contains, plus any
221
- associated interface definition files, plus the scripts used to
222
- control compilation and installation of the executable. However, as a
223
- special exception, the source code distributed need not include
224
- anything that is normally distributed (in either source or binary
225
- form) with the major components (compiler, kernel, and so on) of the
226
- operating system on which the executable runs, unless that component
227
- itself accompanies the executable.
228
-
229
- If distribution of executable or object code is made by offering
230
- access to copy from a designated place, then offering equivalent
231
- access to copy the source code from the same place counts as
232
- distribution of the source code, even though third parties are not
233
- compelled to copy the source along with the object code.
234
-
235
- 4. You may not copy, modify, sublicense, or distribute the Program
236
- except as expressly provided under this License. Any attempt
237
- otherwise to copy, modify, sublicense or distribute the Program is
238
- void, and will automatically terminate your rights under this License.
239
- However, parties who have received copies, or rights, from you under
240
- this License will not have their licenses terminated so long as such
241
- parties remain in full compliance.
242
-
243
- 5. You are not required to accept this License, since you have not
244
- signed it. However, nothing else grants you permission to modify or
245
- distribute the Program or its derivative works. These actions are
246
- prohibited by law if you do not accept this License. Therefore, by
247
- modifying or distributing the Program (or any work based on the
248
- Program), you indicate your acceptance of this License to do so, and
249
- all its terms and conditions for copying, distributing or modifying
250
- the Program or works based on it.
251
-
252
- 6. Each time you redistribute the Program (or any work based on the
253
- Program), the recipient automatically receives a license from the
254
- original licensor to copy, distribute or modify the Program subject to
255
- these terms and conditions. You may not impose any further
256
- restrictions on the recipients' exercise of the rights granted herein.
257
- You are not responsible for enforcing compliance by third parties to
258
- this License.
259
-
260
- 7. If, as a consequence of a court judgment or allegation of patent
261
- infringement or for any other reason (not limited to patent issues),
262
- conditions are imposed on you (whether by court order, agreement or
263
- otherwise) that contradict the conditions of this License, they do not
264
- excuse you from the conditions of this License. If you cannot
265
- distribute so as to satisfy simultaneously your obligations under this
266
- License and any other pertinent obligations, then as a consequence you
267
- may not distribute the Program at all. For example, if a patent
268
- license would not permit royalty-free redistribution of the Program by
269
- all those who receive copies directly or indirectly through you, then
270
- the only way you could satisfy both it and this License would be to
271
- refrain entirely from distribution of the Program.
272
-
273
- If any portion of this section is held invalid or unenforceable under
274
- any particular circumstance, the balance of the section is intended to
275
- apply and the section as a whole is intended to apply in other
276
- circumstances.
277
-
278
- It is not the purpose of this section to induce you to infringe any
279
- patents or other property right claims or to contest validity of any
280
- such claims; this section has the sole purpose of protecting the
281
- integrity of the free software distribution system, which is
282
- implemented by public license practices. Many people have made
283
- generous contributions to the wide range of software distributed
284
- through that system in reliance on consistent application of that
285
- system; it is up to the author/donor to decide if he or she is willing
286
- to distribute software through any other system and a licensee cannot
287
- impose that choice.
288
-
289
- This section is intended to make thoroughly clear what is believed to
290
- be a consequence of the rest of this License.
291
-
292
- 8. If the distribution and/or use of the Program is restricted in
293
- certain countries either by patents or by copyrighted interfaces, the
294
- original copyright holder who places the Program under this License
295
- may add an explicit geographical distribution limitation excluding
296
- those countries, so that distribution is permitted only in or among
297
- countries not thus excluded. In such case, this License incorporates
298
- the limitation as if written in the body of this License.
299
-
300
- 9. The Free Software Foundation may publish revised and/or new versions
301
- of the General Public License from time to time. Such new versions will
302
- be similar in spirit to the present version, but may differ in detail to
303
- address new problems or concerns.
304
-
305
- Each version is given a distinguishing version number. If the Program
306
- specifies a version number of this License which applies to it and "any
307
- later version", you have the option of following the terms and conditions
308
- either of that version or of any later version published by the Free
309
- Software Foundation. If the Program does not specify a version number of
310
- this License, you may choose any version ever published by the Free Software
311
- Foundation.
312
-
313
- 10. If you wish to incorporate parts of the Program into other free
314
- programs whose distribution conditions are different, write to the author
315
- to ask for permission. For software which is copyrighted by the Free
316
- Software Foundation, write to the Free Software Foundation; we sometimes
317
- make exceptions for this. Our decision will be guided by the two goals
318
- of preserving the free status of all derivatives of our free software and
319
- of promoting the sharing and reuse of software generally.
320
-
321
- NO WARRANTY
322
-
323
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
324
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
325
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
326
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
327
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
328
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
329
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
330
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
331
- REPAIR OR CORRECTION.
332
-
333
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
334
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
335
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
336
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
337
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
338
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
339
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
340
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
341
- POSSIBILITY OF SUCH DAMAGES.
342
-
343
- END OF TERMS AND CONDITIONS
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
344
8
 
data/README CHANGED
@@ -71,16 +71,18 @@ from which the typeless numbers derive.
71
71
 
72
72
  === Extensions to the Ruby's Matrix
73
73
 
74
- Also included are Matrix extensions by Cosmin Bonchis, which was done as a Google Summer of
75
- Code 2007 project for Ruby Central Inc.
74
+ Also included are Matrix extensions by Cosmin Bonchis, which was done
75
+ as a Google Summer of Code 2007 project for Ruby Central Inc.
76
76
 
77
- The library consists of some enhancements to the Ruby "Matrix" module and includes:
78
- LU and QR (Householder, Givens, Gram Schmidt, Hessenberg) decompositions, bidiagonalization,
79
- eigenvalue and eigenvector calculations.
77
+ The library consists of some enhancements to the Ruby "Matrix" module
78
+ and includes: LU and QR (Householder, Givens, Gram Schmidt, Hessenberg)
79
+ decompositions, bidiagonalization, eigenvalue and eigenvector calculations.
80
80
 
81
- This library is contatined in stick/matrix.rb, which also draws upon stick/mapcar.rb.
81
+ This library is contatined in stick/matrix.rb, which also draws upon
82
+ stick/mapcar.rb.
82
83
 
83
- This code can also be found on RubyForge at http://rubyforge.org/project/matrix.
84
+ This code can also be found on RubyForge at:
85
+ http://rubyforge.org/project/matrix.
84
86
 
85
87
 
86
88
  == Authors/Contributors
@@ -94,6 +96,7 @@ This code can also be found on RubyForge at http://rubyforge.org/project/matrix.
94
96
 
95
97
  == License
96
98
 
97
- Copyright 2006-2007 Peter Vanbroekhoven, Thomas Sawyer and Contributors
99
+ Copyright 2006, 2007 Peter Vanbroekhoven, Thomas Sawyer
100
+
101
+ Stick is distributed under the terms of the MIT license.
98
102
 
99
- Ruby/GPL Licensed
data/RELEASE CHANGED
@@ -4,7 +4,7 @@ the Scientific Code Kit for Ruby.
4
4
  http://stick.rubyforge.org
5
5
 
6
6
  Stick is a spin-off of Facets, based on the most excellent units.rb
7
- library by Peter Vanbroekhoven. Units.rb, and its cousin currency.rb,
7
+ library by Peter Vanbroekhoven. units.rb, and its cousin currency.rb,
8
8
  provide a very poweful system for working with typed values in a very
9
9
  Ruby-esque way. For example:
10
10
 
@@ -15,15 +15,20 @@ Ruby-esque way. For example:
15
15
 
16
16
  In addition, the library contains a large collection of natural constants,
17
17
  based on the original work of Daniel Carrera and Brian Gough; plus
18
- Cosmin Bonchis' extensions to the Matrix class. In the future, we
19
- expect to add a few more useful science and math oriented libraries.
18
+ Cosmin Bonchis' extensions to the Matrix class.
20
19
 
21
- Please note, despite the 1.x version number, this is still a bit of a nascent
22
- release, as some functionality still needs address. In particular the
23
- *typed* constants and currency conversions are not yet fully functional.
24
- But the rest of the library works well. With any luck some of you will find
25
- the project useful enough to offer a little time to help us polisih it up.
20
+ The goal of this project is to provide a valuable resource for science
21
+ and math oriented developers who like to use Ruby. We fully expect to add
22
+ more useful science and math oriented libraries in the future. If you have
23
+ any libraries that you feel would make a good fit, please let us know.
24
+
25
+ NOTE: Despite the 1.x version number, some functionality still needs
26
+ address. In particular the *typed* constants and currency conversions are
27
+ not yet fully functional. But the rest of the library works well. If any of
28
+ you will find the library useful please consider donating a little time to
29
+ help us polish it up.
26
30
 
27
31
  Thanks and enjoy,
28
32
 
29
33
  Trans and Peter
34
+
@@ -6,23 +6,7 @@
6
6
  #
7
7
  # Copyright (C) 2007 Stick Development Team
8
8
  #
9
- # License:
10
- #
11
- # GNU General Public License
12
- #
13
- # This program is free software; you can redistribute it and/or modify
14
- # it under the terms of the GNU General Public License as published by
15
- # the Free Software Foundation; either version 2 of the License, or (at
16
- # your option) any later version.
17
- #
18
- # This program is distributed in the hope that it will be useful, but
19
- # WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU General Public License
24
- # along with this program; if not, write to the Free Software
25
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9
+ # MIT License
26
10
  #
27
11
  # Authors:
28
12
  #
@@ -6,29 +6,13 @@
6
6
  #
7
7
  # Copyright (C) 2007 Stick Development Team
8
8
  #
9
- # LICENSE:
10
- #
11
- # GNU General Public License
12
- #
13
- # This program is free software; you can redistribute it and/or modify
14
- # it under the terms of the GNU General Public License as published by
15
- # the Free Software Foundation; either version 2 of the License, or (at
16
- # your option) any later version.
17
- #
18
- # This program is distributed in the hope that it will be useful, but
19
- # WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU General Public License
24
- # along with this program; if not, write to the Free Software
25
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9
+ # MIT License
26
10
  #
27
11
  # AUTHORS:
28
12
  #
13
+ # - Thomas Sawyer
29
14
  # - Daniel Carrera
30
15
  # - Brian Gough
31
- # - Thomas Sawyer
32
16
 
33
17
  #
34
18
  module Stick
@@ -6,23 +6,7 @@
6
6
  #
7
7
  # Copyright (C) 2003 Daniel Carrera, Brian Gough
8
8
  #
9
- # License:
10
- #
11
- # GNU General Public License
12
- #
13
- # This program is free software; you can redistribute it and/or modify
14
- # it under the terms of the GNU General Public License as published by
15
- # the Free Software Foundation; either version 2 of the License, or (at
16
- # your option) any later version.
17
- #
18
- # This program is distributed in the hope that it will be useful, but
19
- # WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU General Public License
24
- # along with this program; if not, write to the Free Software
25
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9
+ # MIT License
26
10
  #
27
11
  # Authors:
28
12
  #
@@ -6,29 +6,13 @@
6
6
  #
7
7
  # Copyright (C) 2003 Daniel Carrera, Brian Gough
8
8
  #
9
- # License:
10
- #
11
- # GNU General Public License
12
- #
13
- # This program is free software; you can redistribute it and/or modify
14
- # it under the terms of the GNU General Public License as published by
15
- # the Free Software Foundation; either version 2 of the License, or (at
16
- # your option) any later version.
17
- #
18
- # This program is distributed in the hope that it will be useful, but
19
- # WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU General Public License
24
- # along with this program; if not, write to the Free Software
25
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
9
+ # MIT License
26
10
  #
27
11
  # Authors:
28
12
  #
13
+ # - Thomas Sawyer
29
14
  # - Daniel Carrera
30
15
  # - Brian Gough
31
- # - Thomas Sawyer
32
16
 
33
17
  #
34
18
  module Stick
@@ -6,17 +6,6 @@
6
6
  #
7
7
  # Copyright (c) 2002 K. Kodama
8
8
  #
9
- # License:
10
- #
11
- # Ruby License
12
- #
13
- # This module is free software. You may use, modify, and/or redistribute this
14
- # software under the same terms as Ruby.
15
- #
16
- # This program is distributed in the hope that it will be useful, but WITHOUT
17
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
- # FOR A PARTICULAR PURPOSE.
19
- #
20
9
  # Authors:
21
10
  #
22
11
  # K. Kodama
@@ -17,7 +17,6 @@ lib/stick/currency.rb
17
17
  lib/stick/mapcar.rb
18
18
  lib/stick/matrix.rb
19
19
  lib/stick/quaternion.rb
20
- lib/stick/times.rb
21
20
  lib/stick/units
22
21
  lib/stick/units/base.rb
23
22
  lib/stick/units/currency.rb
@@ -54,10 +53,10 @@ lib/stick/units/units.rb
54
53
  lib/stick/units.rb
55
54
  meta
56
55
  meta/MANIFEST
57
- meta/ROLLRC
58
56
  meta/config.yaml
59
57
  meta/icli.yaml
60
58
  meta/project.yaml
59
+ meta/stick.roll
61
60
  task
62
61
  task/clobber
63
62
  task/clobber/package
@@ -76,3 +75,4 @@ work
76
75
  work/TODO
77
76
  work/bytes.rb
78
77
  work/multipliers.rb
78
+ work/times.rb
@@ -0,0 +1,2 @@
1
+ stick 1.3.1 stable 2007-12-21
2
+ lib/stick
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4.6
3
3
  specification_version: 2
4
4
  name: stick
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.3.0
7
- date: 2007-12-15 00:00:00 -05:00
6
+ version: 1.3.1
7
+ date: 2007-12-21 00:00:00 -05:00
8
8
  summary: Stick is an comprehensive science library including a units system providing bot
9
9
  require_paths:
10
10
  - lib
@@ -52,7 +52,6 @@ files:
52
52
  - task/release
53
53
  - lib
54
54
  - lib/stick
55
- - lib/stick/times.rb
56
55
  - lib/stick/units.rb
57
56
  - lib/stick/quaternion.rb
58
57
  - lib/stick/constants.rb
@@ -103,9 +102,9 @@ files:
103
102
  - COPYING
104
103
  - meta
105
104
  - meta/MANIFEST
106
- - meta/ROLLRC
107
105
  - meta/project.yaml
108
106
  - meta/icli.yaml
107
+ - meta/stick.roll
109
108
  - README
110
109
  - RELEASE
111
110
  test_files:
@@ -1,441 +0,0 @@
1
- # Title:
2
- #
3
- # Times
4
- #
5
- # Summary:
6
- #
7
- # Convenience methods for time.
8
- #
9
- # Copyright:
10
- #
11
- # Copyright (c) 2005 Rich Kilmer, Thomas Sawyer
12
- #
13
- # License:
14
- #
15
- # Ruby License
16
- #
17
- # This module is free software. You may use, modify, and/or redistribute this
18
- # software under the same terms as Ruby.
19
- #
20
- # This program is distributed in the hope that it will be useful, but WITHOUT
21
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
- # FITNESS FOR A PARTICULAR PURPOSE.
23
- #
24
- # History:
25
- #
26
- # Thanks to Richard Kilmer for the orignal work and Alexander Kellett
27
- # for suggesting it for Facets.
28
- #
29
- # Thanks to Dave Hoover and Ryan Platte for the Weekdays implementation.
30
- #
31
- # Authors:
32
- #
33
- # - Rich Kilmer
34
- # - Thomas Sawyer
35
- # - Dave Hoover
36
- # - Ryan Platte
37
- # - George Moschovitis
38
- #
39
- # Notes:
40
- #
41
- # - TODO Extra Add in_* methods, like in_days, in_hours, etc.
42
- #
43
- # - TODO Some Numeric method could still be supported.
44
-
45
- require 'facets/time/change'
46
-
47
- =begin
48
- # = Time In English
49
- #
50
- # Plain-English convenience methods for dealing with dates and times.
51
-
52
- class Numeric
53
-
54
- # Enables the use of time calculations and declarations,
55
- # like 45.minutes + 2.hours + 4.years. The base unit for
56
- # all of these Numeric time methods is seconds.
57
- def seconds ; self ; end
58
- alias_method :second, :seconds
59
- #def as_seconds ; self ; end
60
-
61
- # Converts minutes into seconds.
62
- def minutes ; self * 60 ; end
63
- alias_method :minute, :minutes
64
- #def as_minutes ; self.to_f / 60 ; end
65
-
66
- # Converts hours into seconds.
67
- def hours ; self * 60.minutes ; end
68
- alias_method :hour, :hours
69
- #def as_hours ; self / 60.minutes ; end
70
-
71
- # Converts days into seconds.
72
- def days ; self * 24.hours ; end
73
- alias_method :day, :days
74
- #def as_days ; self / 24.hours ; end
75
-
76
- # Converts weeks into seconds.
77
- def weeks ; self * 7.days ; end
78
- alias_method :week, :weeks
79
- #def as_weeks ; self / 7.days ; end
80
-
81
- # Converts fortnights into seconds.
82
- # (A fortnight is 2 weeks)
83
- def fortnights ; self * 2.weeks ; end
84
- alias_method :fortnight, :fortnights
85
- #def as_fortnights ; self / 2.weeks ; end
86
-
87
- # Converts months into seconds.
88
- # WARNING: This is not exact as it assumes 30 days to a month.
89
- def months ; self * 30.days ; end
90
- alias_method :month, :months
91
- #def as_months ; self / 30.days ; end
92
-
93
- # Converts years into seconds.
94
- def years ; self * 365.days ; end
95
- alias_method :year, :years
96
- #def as_years ; self / 365.days ; end
97
-
98
- # Calculates time _before_ a given time. Default time is now.
99
- # Reads best with arguments: 10.days.before( Time.now - 1.day )
100
- def before(time = ::Time.now)
101
- time - self
102
- end
103
- alias_method :until, :before # Reads best with argument: 10.minutes.until(time)
104
- alias_method :ago, :before # Reads best without arguments: 10.minutes.ago
105
-
106
- # Calculates time _after_ a given time. Default time is now.
107
- # Reads best with argument: 10.minutes.after(time)
108
- def after(time = ::Time.now)
109
- time + self
110
- end
111
- alias_method :since, :after # Reads best with argument: 10.minutes.since(time)
112
- alias_method :from_now, :after # Reads best without arguments: 10.minutes.from_now
113
- alias_method :later, :after # Reads best without arguments: 10.minutes.later
114
-
115
- # Works with day in terms of weekdays.
116
- def weekdays
117
- Weekdays.new(self)
118
- end
119
- alias :weekday :weekdays
120
-
121
- end
122
- =end
123
-
124
-
125
- # The Weekdays class provides useful weekday terminology to Numeric.
126
-
127
- class Weekdays
128
- WEEKDAYS = 1..5 # Monday is wday 1
129
- ONE_DAY = 60 * 60 * 24
130
-
131
- def initialize(n)
132
- @n = n
133
- end
134
-
135
- def ago(time = ::Time.now)
136
- step :down, time
137
- end
138
- alias :until :ago
139
- alias :before :ago
140
-
141
- def since(time = ::Time.now)
142
- step :up, time
143
- end
144
- alias :from_now :since
145
- alias :after :since
146
-
147
- private
148
-
149
- def step(direction, original_time)
150
- result = original_time
151
- time = ONE_DAY
152
-
153
- compare = direction == :up ? ">" : "<"
154
- time *= -1 if direction == :down
155
-
156
- @n.times do
157
- result += time until result.send(compare, original_time) && WEEKDAYS.member?(result.wday)
158
- original_time = result
159
- end
160
- result
161
- end
162
- end
163
-
164
-
165
- class Time
166
-
167
- NEVER = Time.mktime(2038)
168
- ZERO = Time.mktime(1972)
169
-
170
- # CREDIT George Moschovitis
171
-
172
- # This method calculates the days extrema given two time objects.
173
- # start time is the given time1 at 00:00:00
174
- # end time is the given time2 at 23:59:59:999
175
- #
176
- # Input:
177
- # - the two times (if only time1 is provided then you get an extrema
178
- # of exactly one day extrema.
179
- #
180
- # Output:
181
- # - the time range. you can get the start/end times using
182
- # range methods.
183
- #
184
- def self.days_extrema(time1, time2=nil)
185
- time2 = time1 if (not time2.valid? Time)
186
- time2 = NEVER if (time2 <= time1)
187
- start_time = Time.self.start_of_day(time1)
188
- end_time = self.end_of_day(time2)
189
- return (start_time..end_time)
190
- end
191
-
192
- # Seconds since midnight: Time.now.seconds_since_midnight
193
- def seconds_since_midnight
194
- self.hour.hours + self.min.minutes + self.sec + (self.usec/1.0e+6)
195
- end
196
-
197
- # Returns a new Time representing the time a number of seconds ago.
198
- # Do not use this method in combination with x.months, use months_ago instead!
199
- def ago(seconds)
200
- # This is basically a wrapper around the Numeric extension.
201
- #seconds.until(self)
202
- self - seconds
203
- end
204
-
205
- # Returns a new Time representing the time a number of seconds
206
- # since the instance time. Do not use this method in combination
207
- # with x.months, use months_since instead!
208
- def since(seconds)
209
- # This is basically a wrapper around the Numeric extension.
210
- #seconds.since(self)
211
- self + seconds
212
- end
213
- alias_method :in, :since
214
-
215
- # Returns a new Time representing the time a number of specified
216
- # months ago.
217
- def months_ago(months)
218
- if months >= self.month
219
- change(:year => self.year - 1, :month => 12).months_ago(months - self.month)
220
- else
221
- change(:year => self.year, :month => self.month - months)
222
- end
223
- end
224
-
225
- def months_since(months)
226
- if months + self.month > 12
227
- change(:year => self.year + 1, :month => 1).months_since(months - (self.month == 1 ? 12 : (self.month + 1)))
228
- else
229
- change(:year => self.year, :month => self.month + months)
230
- end
231
- end
232
-
233
- # Returns a new Time representing the time a number of specified
234
- # years ago.
235
- def years_ago(years)
236
- change(:year => self.year - years)
237
- end
238
-
239
- def years_since(years)
240
- change(:year => self.year + years)
241
- end
242
-
243
- # Short-hand for months_ago(1)
244
- def last_year
245
- years_since(1)
246
- end
247
-
248
- # Short-hand for months_since(1)
249
- def next_year
250
- years_since(1)
251
- end
252
-
253
- # Short-hand for months_ago(1)
254
- def last_month
255
- months_ago(1)
256
- end
257
-
258
- # Short-hand for months_since(1)
259
- def next_month
260
- months_since(1)
261
- end
262
-
263
- # Returns a new Time representing the "start" of this week (Monday, 0:00)
264
- def beginning_of_week
265
- (self - self.wday.days).midnight + 1.day
266
- end
267
- alias :monday :beginning_of_week
268
- alias :at_beginning_of_week :beginning_of_week
269
-
270
- # Returns a new Time representing the start of the given
271
- # day in next week (default is Monday).
272
- def next_week(day = :monday)
273
- days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2,
274
- :thursday => 3, :friday => 4, :saturday => 5,
275
- :sunday => 6 }
276
- since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0)
277
- end
278
-
279
- # Set time to end of day
280
- #def end_of_day
281
- # return Time.mktime(year, month, day, 23, 59, 59, 999)
282
- #end
283
-
284
- # Returns a new Time representing the start of the day (0:00)
285
- def beginning_of_day
286
- self - self.seconds_since_midnight
287
- end
288
- alias :midnight :beginning_of_day
289
- alias :at_midnight :beginning_of_day
290
- alias :at_beginning_of_day :beginning_of_day
291
- alias :start_of_day :beginning_of_day
292
-
293
- # Returns a new Time representing the start of the month
294
- # (1st of the month, 0:00)
295
- def beginning_of_month
296
- #self - ((self.mday-1).days + self.seconds_since_midnight)
297
- change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)
298
- end
299
- alias_method :at_beginning_of_month, :beginning_of_month
300
-
301
- # Returns a new Time representing the start of the year (1st of january, 0:00)
302
- def beginning_of_year
303
- change(:month => 1,:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)
304
- end
305
- alias :at_beginning_of_year :beginning_of_year
306
-
307
- # Convenience method which returns a new Time representing
308
- # the time 1 day ago
309
- def yesterday
310
- self.ago(1.day)
311
- end
312
-
313
- # Convenience method which returns a new Time representing
314
- # the time 1 day since the instance time
315
- def tomorrow
316
- self.since(1.day)
317
- end
318
-
319
- # Returns a new time at start of day
320
- def to_start_of_day
321
- return Time.mktime(year, month, day, 0, 0, 0, 0)
322
- end
323
-
324
- # Rrturns a new time at end of day
325
- def to_end_of_day
326
- return Time.mktime(year, month, day, 23, 59, 59, 999)
327
- end
328
-
329
- # Returns true only if day of time is included in the
330
- # range (stime..etime). Only year days are checked.
331
- def in_day_range?(stime=ZERO, etime=NEVER)
332
- if (etime <= stime)
333
- warn "invalid end time (#{etime} < #{stime})" if $DEBUG
334
- etime = NEVER
335
- end
336
-
337
- stime = stime.to_start_of_day
338
- etime = etime.to_end_of_day
339
-
340
- return (stime..etime).include?(time)
341
- end
342
- end
343
-
344
-
345
- # _____ _
346
- # |_ _|__ ___| |_
347
- # | |/ _ \/ __| __|
348
- # | | __/\__ \ |_
349
- # |_|\___||___/\__|
350
- #
351
-
352
- =begin testing
353
-
354
- require 'test/unit'
355
- #require 'mega/multiplier'
356
-
357
- class NumericTest < Test::Unit::TestCase
358
-
359
- #def test_micro_seconds
360
- # assert_equal( 0.000001, 1.microsecond )
361
- #end
362
-
363
- #def test_milli_seconds
364
- # assert_equal( 0.001, 1.millisecond )
365
- #end
366
-
367
- def test_seconds
368
- assert_equal( 60**0, 1.seconds )
369
- end
370
-
371
- def test_minutes
372
- assert_equal( 60**1, 1.minutes )
373
- end
374
-
375
- def test_hours
376
- assert_equal( 60**2, 1.hours )
377
- end
378
-
379
- def test_days
380
- assert_equal( 24*(60**2), 1.days )
381
- end
382
-
383
- def test_weeks
384
- assert_equal( 7*24*(60**2), 1.weeks )
385
- end
386
-
387
- def test_fortnights
388
- assert_equal( 14*24*(60**2), 1.fortnights )
389
- end
390
-
391
- def test_months
392
- assert_equal( 30*24*(60**2), 1.months )
393
- end
394
-
395
- def test_years
396
- assert_equal( 365*24*(60**2), 1.years )
397
- end
398
-
399
- def test_before
400
- t = Time.now
401
- assert_equal( t - 1.day, 1.day.before(t) )
402
- end
403
-
404
- def test_after
405
- t = Time.now
406
- assert_equal( t + 1.day, 1.day.after(t) )
407
- end
408
-
409
- end
410
-
411
- class WeekdaysTest < Test::Unit::TestCase
412
-
413
- MONDAY = Time.at(1165250000)
414
- THURSDAY = Time.at(1165500000)
415
- FRIDAY = Time.at(1165606025)
416
-
417
- def test_weekday_after_monday
418
- assert_equal 2, 1.weekday.since(MONDAY).wday
419
- end
420
-
421
- def test_weekday_after_friday
422
- assert_equal 1, 1.weekday.after(FRIDAY).wday
423
- end
424
-
425
- def test_weekdays_before_friday
426
- assert_equal 2, 3.weekdays.before(FRIDAY).wday
427
- end
428
-
429
- #def test_weekday_before_today
430
- # Time.expects(:now).returns(THURSDAY)
431
- # assert_equal 3, 1.weekday.ago.wday
432
- #end
433
-
434
- #def test_weekdays_after_today
435
- # Time.expects(:now).returns(MONDAY)
436
- # assert_equal 3, 2.weekday.from_now.wday
437
- #end
438
-
439
- end
440
-
441
- =end
@@ -1,2 +0,0 @@
1
- stick 1.3.0 stable 2007-12-11
2
- lib/stick