third_base 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README +10 -10
- data/lib/third_base/date.rb +2 -2
- data/spec/date/strptime_spec.rb +2 -2
- metadata +3 -3
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2008 Jeremy Evans <code@jeremyevans.net>
|
1
|
+
Copyright (c) 2008-2009 Jeremy Evans <code@jeremyevans.net>
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README
CHANGED
@@ -18,19 +18,19 @@ and the fact that the Astronomical Julian Date differs from the Julian
|
|
18
18
|
Date, much of the complexity of Ruby's standard Date/DateTime class can
|
19
19
|
be removed, and there can be significant improvements in speed.
|
20
20
|
|
21
|
-
==
|
22
|
-
|
23
|
-
sudo gem install third_base
|
24
|
-
|
25
|
-
== Source
|
21
|
+
== Resources
|
26
22
|
|
27
|
-
|
23
|
+
* {RDoc}[http://third-base.rubyforge.org]
|
24
|
+
* {Source code}[http://github.com/jeremyevans/third_base]
|
25
|
+
* {Bug tracking}[http://rubyforge.org/projects/third-base/]
|
28
26
|
|
29
|
-
|
27
|
+
To check out the source code:
|
28
|
+
|
29
|
+
git clone git://github.com/jeremyevans/third_base.git
|
30
30
|
|
31
|
-
|
31
|
+
== Installation
|
32
32
|
|
33
|
-
|
33
|
+
sudo gem install third_base
|
34
34
|
|
35
35
|
== Usage and Compatibility
|
36
36
|
|
@@ -220,7 +220,7 @@ To modify the order of parser types:
|
|
220
220
|
|
221
221
|
=== Real World Example
|
222
222
|
|
223
|
-
ThirdBase was written to solve a real world problem, slow
|
223
|
+
ThirdBase was written to solve a real world problem, slow retrieval of records
|
224
224
|
from a database because they contained many date fields. The table in
|
225
225
|
question (employees), has 23 fields, 5 of which are date fields. Here are
|
226
226
|
the results of selecting all records for the database via Sequel, both with
|
data/lib/third_base/date.rb
CHANGED
@@ -24,8 +24,8 @@ module ThirdBase
|
|
24
24
|
|
25
25
|
CUMMULATIVE_MONTH_DAYS = {1=>0, 2=>31, 3=>59, 4=>90, 5=>120, 6=>151, 7=>181, 8=>212, 9=>243, 10=>273, 11=>304, 12=>334}
|
26
26
|
LEAP_CUMMULATIVE_MONTH_DAYS = {1=>0, 2=>31, 3=>60, 4=>91, 5=>121, 6=>152, 7=>182, 8=>213, 9=>244, 10=>274, 11=>305, 12=>335}
|
27
|
-
DAYS_IN_MONTH = {1=>
|
28
|
-
LEAP_DAYS_IN_MONTH = {1=>
|
27
|
+
DAYS_IN_MONTH = {1=>31, 2=>28, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31}
|
28
|
+
LEAP_DAYS_IN_MONTH = {1=>31, 2=>29, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31}
|
29
29
|
|
30
30
|
MONTHNAME_RE_PATTERN = "(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|september|october|november|december)"
|
31
31
|
FULL_MONTHNAME_RE_PATTERN = "(january|february|march|april|may|june|july|august|september|october|november|december)"
|
data/spec/date/strptime_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe "Date#stpftime" do
|
|
59
59
|
|
60
60
|
it "should be able to parse the year day with leading zeroes" do
|
61
61
|
d = Date.today
|
62
|
-
Date.strptime("050", "%j").should == Date.civil(
|
62
|
+
Date.strptime("050", "%j").should == Date.civil(Date.today.year, 2, 19)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should be able to parse the month with leading zeroes" do
|
@@ -115,4 +115,4 @@ describe "Date#stpftime" do
|
|
115
115
|
Date.strptime("04/06/00", "%m/%d/%y").should == Date.civil(2000, 4, 6)
|
116
116
|
end
|
117
117
|
|
118
|
-
end
|
118
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: third_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-09 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements: []
|
100
100
|
|
101
101
|
rubyforge_project: third-base
|
102
|
-
rubygems_version: 1.3.
|
102
|
+
rubygems_version: 1.3.1
|
103
103
|
signing_key:
|
104
104
|
specification_version: 2
|
105
105
|
summary: A Fast and Easy Date/DateTime Class
|