tod 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +89 -0
- data/Rakefile +11 -0
- data/lib/tod/date.rb +6 -0
- data/lib/tod/time.rb +5 -0
- data/lib/tod/time_of_day.rb +129 -0
- data/lib/tod/version.rb +3 -0
- data/lib/tod.rb +3 -0
- data/test/test_helper.rb +6 -0
- data/test/tod/date_test.rb +11 -0
- data/test/tod/time_of_day_test.rb +183 -0
- data/test/tod/time_test.rb +10 -0
- data/tod.gemspec +23 -0
- metadata +116 -0
data/.gitignore
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Jack Christensen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
Tod
|
2
|
+
===
|
3
|
+
|
4
|
+
Supplies TimeOfDay class that includes parsing, strftime, comparison, and
|
5
|
+
arithmetic.
|
6
|
+
|
7
|
+
|
8
|
+
Installation
|
9
|
+
============
|
10
|
+
|
11
|
+
gem install tod
|
12
|
+
|
13
|
+
Examples
|
14
|
+
========
|
15
|
+
|
16
|
+
Loading Tod
|
17
|
+
-----------
|
18
|
+
|
19
|
+
require 'tod'
|
20
|
+
|
21
|
+
Creating from hour, minute, and second
|
22
|
+
--------------------------------------
|
23
|
+
|
24
|
+
TimeOfDay.new 8 # => 08:00:00
|
25
|
+
TimeOfDay.new 8, 15, 30 # => 08:15:30
|
26
|
+
|
27
|
+
Parsing text
|
28
|
+
------------
|
29
|
+
|
30
|
+
Strings only need to contain an hour. Minutes, seconds, AM or PM, and colons
|
31
|
+
are all optional.
|
32
|
+
|
33
|
+
TimeOfDay.parse "8" # => 08:00:00
|
34
|
+
TimeOfDay.parse "8am" # => 08:00:00
|
35
|
+
TimeOfDay.parse "8pm" # => 20:00:00
|
36
|
+
TimeOfDay.parse "8p" # => 20:00:00
|
37
|
+
TimeOfDay.parse "9:30" # => 09:30:00
|
38
|
+
TimeOfDay.parse "15:30" # => 15:30:00
|
39
|
+
TimeOfDay.parse "3:30pm" # => 15:30:00
|
40
|
+
TimeOfDay.parse "1230" # => 12:30:00
|
41
|
+
TimeOfDay.parse "3:25:58" # => 03:25:58
|
42
|
+
TimeOfDay.parse "515p" # => 17:15:00
|
43
|
+
TimeOfDay.parse "151253" # => 15:12:53
|
44
|
+
|
45
|
+
Adding or subtracting time
|
46
|
+
-----------------------------
|
47
|
+
|
48
|
+
Seconds can be added to or subtracted TimeOfDay objects. Time correctly wraps
|
49
|
+
around midnight.
|
50
|
+
|
51
|
+
TimeOfDay.new(8) + 3600 # => 09:00:00
|
52
|
+
TimeOfDay.new(8) - 3600 # => 07:00:00
|
53
|
+
TimeOfDay.new(0) - 30 # => 23:59:30
|
54
|
+
TimeOfDay.new(23,59,45) + 30 # => 00:00:15
|
55
|
+
|
56
|
+
Comparing
|
57
|
+
--------------------
|
58
|
+
|
59
|
+
TimeOfDay includes Comparable.
|
60
|
+
|
61
|
+
TimeOfDay.new(8) < TimeOfDay.new(9) # => true
|
62
|
+
TimeOfDay.new(8) == TimeOfDay.new(9) # => false
|
63
|
+
TimeOfDay.new(9) == TimeOfDay.new(9) # => true
|
64
|
+
TimeOfDay.new(10) > TimeOfDay.new(9) # => true
|
65
|
+
|
66
|
+
Formatting
|
67
|
+
----------
|
68
|
+
|
69
|
+
Format strings are passed to Time#strftime.
|
70
|
+
|
71
|
+
TimeOfDay.new(8,30).strftime("%H:%M") # => "08:30"
|
72
|
+
TimeOfDay.new(17,15).strftime("%I:%M %p") # => "05:15 PM"
|
73
|
+
TimeOfDay.new(22,5,15).strftime("%I:%M:%S %p") # => "10:05:15 PM"
|
74
|
+
|
75
|
+
Convenience methods for dates and times
|
76
|
+
---------------------------------------
|
77
|
+
|
78
|
+
Tod adds Date#on and Time#to_time_of_day. If you do not want the core extensions
|
79
|
+
then require 'tod/time_of_day' instead of 'tod'.
|
80
|
+
|
81
|
+
tod = TimeOfDay.new 8, 30 # => 08:30:00
|
82
|
+
tod.on Date.today # => 2010-12-29 08:30:00 -0600
|
83
|
+
Date.today.at tod # => 2010-12-29 08:30:00 -0600
|
84
|
+
Time.now.to_time_of_day # => 16:30:43
|
85
|
+
|
86
|
+
License
|
87
|
+
=======
|
88
|
+
|
89
|
+
Copyright (c) 2010 Jack Christensen, released under the MIT license
|
data/Rakefile
ADDED
data/lib/tod/date.rb
ADDED
data/lib/tod/time.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
module Tod
|
2
|
+
class TimeOfDay
|
3
|
+
include Comparable
|
4
|
+
|
5
|
+
attr_reader :hour, :minute, :second, :second_of_day
|
6
|
+
alias_method :min, :minute
|
7
|
+
alias_method :sec, :second
|
8
|
+
|
9
|
+
PARSE_24H_REGEX = /
|
10
|
+
\A
|
11
|
+
([01]?\d|2[0-3])
|
12
|
+
:?
|
13
|
+
([0-5]\d)?
|
14
|
+
:?
|
15
|
+
([0-5]\d)?
|
16
|
+
\z
|
17
|
+
/x
|
18
|
+
|
19
|
+
PARSE_12H_REGEX = /
|
20
|
+
\A
|
21
|
+
(0?\d|1[0-2])
|
22
|
+
:?
|
23
|
+
([0-5]\d)?
|
24
|
+
:?
|
25
|
+
([0-5]\d)?
|
26
|
+
\s*
|
27
|
+
([ap])
|
28
|
+
\.?
|
29
|
+
\s*
|
30
|
+
m?
|
31
|
+
\.?
|
32
|
+
\z
|
33
|
+
/x
|
34
|
+
|
35
|
+
NUM_SECONDS_IN_DAY = 86400
|
36
|
+
NUM_SECONDS_IN_HOUR = 3600
|
37
|
+
NUM_SECONDS_IN_MINUTE = 60
|
38
|
+
|
39
|
+
def initialize(h, m=0, s=0)
|
40
|
+
@hour = Integer(h)
|
41
|
+
@minute = Integer(m)
|
42
|
+
@second = Integer(s)
|
43
|
+
|
44
|
+
raise ArgumentError, "hour must be between 0 and 23" unless (0..23).include?(@hour)
|
45
|
+
raise ArgumentError, "minute must be between 0 and 59" unless (0..59).include?(@minute)
|
46
|
+
raise ArgumentError, "second must be between 0 and 59" unless (0..59).include?(@second)
|
47
|
+
|
48
|
+
@second_of_day = @hour * 60 * 60 + @minute * 60 + @second
|
49
|
+
|
50
|
+
freeze # TimeOfDay instances are value objects
|
51
|
+
end
|
52
|
+
|
53
|
+
def <=>(other)
|
54
|
+
@second_of_day <=> other.second_of_day
|
55
|
+
end
|
56
|
+
|
57
|
+
# Formats identically to Time#strftime
|
58
|
+
def strftime(format_string)
|
59
|
+
Time.local(2000,1,1, @hour, @minute, @second).strftime(format_string)
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_s
|
63
|
+
strftime "%H:%M:%S"
|
64
|
+
end
|
65
|
+
|
66
|
+
# Return a new TimeOfDay num_seconds greater than self. It will wrap around
|
67
|
+
# at midnight.
|
68
|
+
def +(num_seconds)
|
69
|
+
TimeOfDay.from_second_of_day @second_of_day + num_seconds
|
70
|
+
end
|
71
|
+
|
72
|
+
# Return a new TimeOfDay num_seconds less than self. It will wrap around
|
73
|
+
# at midnight.
|
74
|
+
def -(num_seconds)
|
75
|
+
TimeOfDay.from_second_of_day @second_of_day - num_seconds
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns a Time instance on date using self as the time of day
|
79
|
+
def on(date)
|
80
|
+
Time.local date.year, date.month, date.day, @hour, @minute, @second
|
81
|
+
end
|
82
|
+
|
83
|
+
# Build a new TimeOfDay instance from second_of_day
|
84
|
+
#
|
85
|
+
# TimeOfDay.from_second_of_day(3600) == TimeOfDay.new(1) # => true
|
86
|
+
def self.from_second_of_day(second_of_day)
|
87
|
+
remaining_seconds = second_of_day % NUM_SECONDS_IN_DAY
|
88
|
+
hour = remaining_seconds / NUM_SECONDS_IN_HOUR
|
89
|
+
remaining_seconds -= hour * NUM_SECONDS_IN_HOUR
|
90
|
+
minute = remaining_seconds / NUM_SECONDS_IN_MINUTE
|
91
|
+
remaining_seconds -= minute * NUM_SECONDS_IN_MINUTE
|
92
|
+
new hour, minute, remaining_seconds
|
93
|
+
end
|
94
|
+
|
95
|
+
# Build a TimeOfDay instance from string
|
96
|
+
#
|
97
|
+
# Strings only need to contain an hour. Minutes, seconds, AM or PM, and colons
|
98
|
+
# are all optional.
|
99
|
+
# TimeOfDay.parse "8" # => 08:00:00
|
100
|
+
# TimeOfDay.parse "8am" # => 08:00:00
|
101
|
+
# TimeOfDay.parse "8pm" # => 20:00:00
|
102
|
+
# TimeOfDay.parse "8p" # => 20:00:00
|
103
|
+
# TimeOfDay.parse "9:30" # => 09:30:00
|
104
|
+
# TimeOfDay.parse "15:30" # => 15:30:00
|
105
|
+
# TimeOfDay.parse "3:30pm" # => 15:30:00
|
106
|
+
# TimeOfDay.parse "1230" # => 12:30:00
|
107
|
+
# TimeOfDay.parse "3:25:58" # => 03:25:58
|
108
|
+
# TimeOfDay.parse "515p" # => 17:15:00
|
109
|
+
# TimeOfDay.parse "151253" # => 15:12:53
|
110
|
+
def self.parse(tod_string)
|
111
|
+
tod_string = tod_string.strip
|
112
|
+
tod_string = tod_string.downcase
|
113
|
+
if PARSE_24H_REGEX =~ tod_string || PARSE_12H_REGEX =~ tod_string
|
114
|
+
hour, minute, second, a_or_p = $1.to_i, $2.to_i, $3.to_i, $4
|
115
|
+
if hour == 12 && a_or_p == "a"
|
116
|
+
hour = 0
|
117
|
+
elsif hour < 12 && a_or_p == "p"
|
118
|
+
hour += 12
|
119
|
+
end
|
120
|
+
|
121
|
+
new hour, minute, second
|
122
|
+
else
|
123
|
+
raise ArgumentError, "Invalid time of day string"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
TimeOfDay = Tod::TimeOfDay
|
data/lib/tod/version.rb
ADDED
data/lib/tod.rb
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
|
2
|
+
|
3
|
+
class DateTest < Test::Unit::TestCase
|
4
|
+
context "at" do
|
5
|
+
should "accept TimeOfDay and return Time on same date" do
|
6
|
+
date = Date.civil 2000,1,1
|
7
|
+
tod = TimeOfDay.new 8,30
|
8
|
+
assert_equal Time.local(2000,1,1, 8,30), date.at(tod)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
|
2
|
+
|
3
|
+
class TimeOfDayTest < Test::Unit::TestCase
|
4
|
+
context "initialize" do
|
5
|
+
should "block invalid hours" do
|
6
|
+
assert_raise(ArgumentError) { TimeOfDay.new -1 }
|
7
|
+
assert_raise(ArgumentError) { TimeOfDay.new 24 }
|
8
|
+
end
|
9
|
+
|
10
|
+
should "block invalid minutes" do
|
11
|
+
assert_raise(ArgumentError) { TimeOfDay.new 0, -1 }
|
12
|
+
assert_raise(ArgumentError) { TimeOfDay.new 0, 60 }
|
13
|
+
end
|
14
|
+
|
15
|
+
should "block invalid seconds" do
|
16
|
+
assert_raise(ArgumentError) { TimeOfDay.new 0, 0, -1 }
|
17
|
+
assert_raise(ArgumentError) { TimeOfDay.new 0, 0, 60 }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "second_of_day" do
|
22
|
+
should "be 0 at midnight" do
|
23
|
+
assert_equal 0, TimeOfDay.new(0,0,0).second_of_day
|
24
|
+
end
|
25
|
+
|
26
|
+
should "be 3661 at 1:01:01" do
|
27
|
+
assert_equal 3661, TimeOfDay.new(1,1,1).second_of_day
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be 86399 at last second of day" do
|
31
|
+
assert_equal 86399, TimeOfDay.new(23,59,59).second_of_day
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.should_parse(parse_string, expected_hour, expected_minute, expected_second)
|
36
|
+
expected_tod = TimeOfDay.new expected_hour, expected_minute, expected_second
|
37
|
+
|
38
|
+
should "parse '#{parse_string}' into #{expected_tod.inspect}" do
|
39
|
+
assert_equal expected_tod, TimeOfDay.parse(parse_string)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.should_not_parse(parse_string)
|
44
|
+
should "not parse '#{parse_string}'" do
|
45
|
+
assert_raise(ArgumentError) { TimeOfDay.parse(parse_string) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
should_parse "9", 9, 0, 0
|
50
|
+
should_parse "13", 13, 0, 0
|
51
|
+
should_parse "1230", 12,30, 0
|
52
|
+
should_parse "08:15", 8,15, 0
|
53
|
+
should_parse "08:15:30", 8,15,30
|
54
|
+
should_parse "18", 18, 0, 0
|
55
|
+
should_parse "23", 23, 0, 0
|
56
|
+
|
57
|
+
should_parse "9a", 9, 0, 0
|
58
|
+
should_parse "900a", 9, 0, 0
|
59
|
+
should_parse "9A", 9, 0, 0
|
60
|
+
should_parse "9am", 9, 0, 0
|
61
|
+
should_parse "9AM", 9, 0, 0
|
62
|
+
should_parse "9 a", 9, 0, 0
|
63
|
+
should_parse "9 am", 9, 0, 0
|
64
|
+
should_parse "09:30:45 am", 9,30,45
|
65
|
+
|
66
|
+
should_parse "9p", 21, 0, 0
|
67
|
+
should_parse "900p", 21, 0, 0
|
68
|
+
should_parse "9P", 21, 0, 0
|
69
|
+
should_parse "9pm", 21, 0, 0
|
70
|
+
should_parse "9PM", 21, 0, 0
|
71
|
+
should_parse "9 p", 21, 0, 0
|
72
|
+
should_parse "9 pm", 21, 0, 0
|
73
|
+
should_parse "09:30:45 pm", 21,30,45
|
74
|
+
|
75
|
+
should_parse "12a", 0, 0, 0
|
76
|
+
should_parse "12p", 12, 0, 0
|
77
|
+
|
78
|
+
should_not_parse "-1:30"
|
79
|
+
should_not_parse "24:00:00"
|
80
|
+
should_not_parse "24"
|
81
|
+
should_not_parse "00:60"
|
82
|
+
should_not_parse "00:00:60"
|
83
|
+
should_not_parse "13a"
|
84
|
+
should_not_parse "13p"
|
85
|
+
should_not_parse "10.5"
|
86
|
+
|
87
|
+
should "provide spaceship operator" do
|
88
|
+
assert_equal -1, TimeOfDay.new(8,0,0) <=> TimeOfDay.new(9,0,0)
|
89
|
+
assert_equal 0, TimeOfDay.new(9,0,0) <=> TimeOfDay.new(9,0,0)
|
90
|
+
assert_equal 1, TimeOfDay.new(10,0,0) <=> TimeOfDay.new(9,0,0)
|
91
|
+
end
|
92
|
+
|
93
|
+
should "compare equality by value" do
|
94
|
+
assert_equal TimeOfDay.new(8,0,0), TimeOfDay.new(8,0,0)
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
context "strftime" do
|
99
|
+
should "delegate to Time.parse" do
|
100
|
+
format_string = "%H:%M"
|
101
|
+
Time.any_instance.expects(:strftime).with(format_string)
|
102
|
+
TimeOfDay.new(8,15,30).strftime format_string
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "to_s" do
|
107
|
+
should "format to HH:MM:SS" do
|
108
|
+
assert_equal "08:15:30", TimeOfDay.new(8,15,30).to_s
|
109
|
+
assert_equal "22:10:45", TimeOfDay.new(22,10,45).to_s
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "addition" do
|
114
|
+
should "add seconds" do
|
115
|
+
original = TimeOfDay.new(8,0,0)
|
116
|
+
result = original + 15
|
117
|
+
assert_equal TimeOfDay.new(8,0,15), result
|
118
|
+
end
|
119
|
+
|
120
|
+
should "wrap around midnight" do
|
121
|
+
original = TimeOfDay.new(23,0,0)
|
122
|
+
result = original + 7200
|
123
|
+
assert_equal TimeOfDay.new(1,0,0), result
|
124
|
+
end
|
125
|
+
|
126
|
+
should "return new TimeOfDay" do
|
127
|
+
original = TimeOfDay.new(8,0,0)
|
128
|
+
result = original + 15
|
129
|
+
assert_not_equal original.object_id, result.object_id
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "subtraction" do
|
134
|
+
should "subtract seconds" do
|
135
|
+
original = TimeOfDay.new(8,0,0)
|
136
|
+
result = original - 15
|
137
|
+
assert_equal TimeOfDay.new(7,59,45), result
|
138
|
+
end
|
139
|
+
|
140
|
+
should "wrap around midnight" do
|
141
|
+
original = TimeOfDay.new(1,0,0)
|
142
|
+
result = original - 7200
|
143
|
+
assert_equal TimeOfDay.new(23,0,0), result
|
144
|
+
end
|
145
|
+
|
146
|
+
should "return new TimeOfDay" do
|
147
|
+
original = TimeOfDay.new(8,0,0)
|
148
|
+
result = original - 15
|
149
|
+
assert_not_equal original.object_id, result.object_id
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "from_second_of_day" do
|
154
|
+
should "handle positive numbers" do
|
155
|
+
assert_equal TimeOfDay.new(0,0,30), TimeOfDay.from_second_of_day(30)
|
156
|
+
assert_equal TimeOfDay.new(0,1,30), TimeOfDay.from_second_of_day(90)
|
157
|
+
assert_equal TimeOfDay.new(1,1,5), TimeOfDay.from_second_of_day(3665)
|
158
|
+
assert_equal TimeOfDay.new(23,59,59), TimeOfDay.from_second_of_day(86399)
|
159
|
+
end
|
160
|
+
|
161
|
+
should "handle positive numbers a day or more away" do
|
162
|
+
assert_equal TimeOfDay.new(0,0,0), TimeOfDay.from_second_of_day(86400)
|
163
|
+
assert_equal TimeOfDay.new(0,0,30), TimeOfDay.from_second_of_day(86430)
|
164
|
+
assert_equal TimeOfDay.new(0,1,30), TimeOfDay.from_second_of_day(86490)
|
165
|
+
assert_equal TimeOfDay.new(1,1,5), TimeOfDay.from_second_of_day(90065)
|
166
|
+
assert_equal TimeOfDay.new(23,59,59), TimeOfDay.from_second_of_day(172799)
|
167
|
+
end
|
168
|
+
|
169
|
+
should "handle negative numbers" do
|
170
|
+
assert_equal TimeOfDay.new(23,59,30), TimeOfDay.from_second_of_day(-30)
|
171
|
+
end
|
172
|
+
|
173
|
+
should "handle negative numbers more than a day away" do
|
174
|
+
assert_equal TimeOfDay.new(23,59,30), TimeOfDay.from_second_of_day(-86430)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
context "on" do
|
179
|
+
should "be local Time on given date" do
|
180
|
+
assert_equal Time.local(2010,12,29, 8,30), TimeOfDay.new(8,30).on(Date.civil(2010,12,29))
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','test_helper'))
|
2
|
+
|
3
|
+
class TimeTest < Test::Unit::TestCase
|
4
|
+
context "to_time_of_day" do
|
5
|
+
should "be TimeOfDay" do
|
6
|
+
time = Time.local 2000,1,1, 12,30,15
|
7
|
+
assert_equal TimeOfDay.new(12,30,15), time.to_time_of_day
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/tod.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "tod/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "tod"
|
7
|
+
s.version = TimeOfDay::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jack Christensen"]
|
10
|
+
s.email = ["jack@jackchristensen.com"]
|
11
|
+
s.homepage = "https://github.com/JackC/tod"
|
12
|
+
s.summary = %q{Supplies TimeOfDay class}
|
13
|
+
s.description = %q{Supplies TimeOfDay class that includes parsing, strftime, comparison, and arithmetic.}
|
14
|
+
|
15
|
+
s.add_development_dependency "test-unit"
|
16
|
+
s.add_development_dependency "shoulda"
|
17
|
+
s.add_development_dependency "mocha"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tod
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jack Christensen
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-12-29 00:00:00 -06:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: test-unit
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :development
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: shoulda
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
44
|
+
type: :development
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: mocha
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id003
|
59
|
+
description: Supplies TimeOfDay class that includes parsing, strftime, comparison, and arithmetic.
|
60
|
+
email:
|
61
|
+
- jack@jackchristensen.com
|
62
|
+
executables: []
|
63
|
+
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- MIT-LICENSE
|
71
|
+
- README.markdown
|
72
|
+
- Rakefile
|
73
|
+
- lib/tod.rb
|
74
|
+
- lib/tod/date.rb
|
75
|
+
- lib/tod/time.rb
|
76
|
+
- lib/tod/time_of_day.rb
|
77
|
+
- lib/tod/version.rb
|
78
|
+
- test/test_helper.rb
|
79
|
+
- test/tod/date_test.rb
|
80
|
+
- test/tod/time_of_day_test.rb
|
81
|
+
- test/tod/time_test.rb
|
82
|
+
- tod.gemspec
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: https://github.com/JackC/tod
|
85
|
+
licenses: []
|
86
|
+
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
requirements: []
|
109
|
+
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 1.3.7
|
112
|
+
signing_key:
|
113
|
+
specification_version: 3
|
114
|
+
summary: Supplies TimeOfDay class
|
115
|
+
test_files: []
|
116
|
+
|