tod 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd1afa5d7028c81edd6ccd8b2ed7937bd79b3f64
4
+ data.tar.gz: 9765dafb8c5a03311d4fc9db18a38082a48e112e
5
+ SHA512:
6
+ metadata.gz: f332abbc345efa5d21623e300acf614a03b1005e415cef4f098536a8e8ac56edc9685aef8fb72bdb97d7f02ed80bb22ead96aafa2a5f3b5bab1ca4aa9f03e1e4
7
+ data.tar.gz: a43fdedbac428c5ac59b0ae0b1427d46c7742f3617b0f220dedbad0e61f8aed5ac813c36593abd7694d49cd4db70b981ace140610a6492f98b3ddaab6d927969
data/README.markdown CHANGED
@@ -88,7 +88,22 @@ Rails Time Zone Support
88
88
 
89
89
  If Rails time zone support is loaded, Date#on and TimeOfDay#at will automatically use Time.zone.
90
90
 
91
+ History
92
+ =======
93
+
94
+ # 1.1.1 (April 12, 2013)
95
+
96
+ * Added to_i and from_i as aliases of second_of_day and from_second_of_day (Johnny Shields)
97
+
98
+ # 1.1.0 (February 13, 2013)
99
+
100
+ * Added Rails time zone support
101
+
102
+ # 1.0.0 (December 29, 2010)
103
+
104
+ * Initial Release
105
+
91
106
  License
92
107
  =======
93
108
 
94
- Copyright (c) 2010-2103 Jack Christensen, released under the MIT license
109
+ Copyright (c) 2010-2013 Jack Christensen, released under the MIT license
@@ -5,6 +5,7 @@ module Tod
5
5
  attr_reader :hour, :minute, :second, :second_of_day
6
6
  alias_method :min, :minute
7
7
  alias_method :sec, :second
8
+ alias_method :to_i, :second_of_day
8
9
 
9
10
  PARSE_24H_REGEX = /
10
11
  \A
@@ -92,6 +93,9 @@ module Tod
92
93
  remaining_seconds -= minute * NUM_SECONDS_IN_MINUTE
93
94
  new hour, minute, remaining_seconds
94
95
  end
96
+ class << self
97
+ alias :from_i :from_second_of_day
98
+ end
95
99
 
96
100
  # Build a TimeOfDay instance from string
97
101
  #
data/lib/tod/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class TimeOfDay
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -31,6 +31,11 @@ class TimeOfDayTest < Test::Unit::TestCase
31
31
  should "be 86399 at last second of day" do
32
32
  assert_equal 86399, TimeOfDay.new(23,59,59).second_of_day
33
33
  end
34
+
35
+ should "have alias to_i" do
36
+ tod = TimeOfDay.new(0,0,0)
37
+ assert_equal tod.method(:second_of_day), tod.method(:to_i)
38
+ end
34
39
  end
35
40
 
36
41
  def self.should_parse(parse_string, expected_hour, expected_minute, expected_second)
@@ -111,6 +116,13 @@ class TimeOfDayTest < Test::Unit::TestCase
111
116
  end
112
117
  end
113
118
 
119
+ context "to_i" do
120
+ should "format to integer" do
121
+ assert_equal 29730, TimeOfDay.new(8,15,30).to_i
122
+ assert TimeOfDay.new(22,10,45).to_i.is_a? Integer
123
+ end
124
+ end
125
+
114
126
  context "addition" do
115
127
  should "add seconds" do
116
128
  original = TimeOfDay.new(8,0,0)
@@ -174,6 +186,10 @@ class TimeOfDayTest < Test::Unit::TestCase
174
186
  should "handle negative numbers more than a day away" do
175
187
  assert_equal TimeOfDay.new(23,59,30), TimeOfDay.from_second_of_day(-86430)
176
188
  end
189
+
190
+ should "have alias from_i" do
191
+ assert_equal TimeOfDay.method(:from_second_of_day), TimeOfDay.method(:from_i)
192
+ end
177
193
  end
178
194
 
179
195
  context "on" do
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tod
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jack Christensen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
11
+ date: 2013-04-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: test-unit
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: shoulda
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mocha
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: active_support
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '3.0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '3.0'
78
69
  description: Supplies TimeOfDay class that includes parsing, strftime, comparison,
@@ -101,27 +92,26 @@ files:
101
92
  - tod.gemspec
102
93
  homepage: https://github.com/JackC/tod
103
94
  licenses: []
95
+ metadata: {}
104
96
  post_install_message:
105
97
  rdoc_options: []
106
98
  require_paths:
107
99
  - lib
108
100
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
101
  requirements:
111
- - - ! '>='
102
+ - - '>='
112
103
  - !ruby/object:Gem::Version
113
104
  version: '0'
114
105
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
106
  requirements:
117
- - - ! '>='
107
+ - - '>='
118
108
  - !ruby/object:Gem::Version
119
109
  version: '0'
120
110
  requirements: []
121
111
  rubyforge_project:
122
- rubygems_version: 1.8.23
112
+ rubygems_version: 2.0.0
123
113
  signing_key:
124
- specification_version: 3
114
+ specification_version: 4
125
115
  summary: Supplies TimeOfDay class
126
116
  test_files:
127
117
  - test/test_helper.rb