tod 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9abbaa919b6c5095de1d85a9e4db5da1160d4d80038515366502c2144d007b75
4
- data.tar.gz: 87106d404f688c2ba9997b18874172440f34f7bcacfe35f41c693309693c7654
3
+ metadata.gz: 4c1822f3d5a2b798f5b61037371706e54b7588491c9470d8072ad93212239662
4
+ data.tar.gz: c9d25f0ec776493e5afe4cd2194b6d6d2226f43663842891c65efaef6224fc10
5
5
  SHA512:
6
- metadata.gz: a890e3dc2b7aee24401388d8d85214c01e0f730c0547a61f7c46d9a097dce842fccf2a43836d46e52af3eba87f1df2c9aa2bd13fe6f10f5e780b085e43b9741d
7
- data.tar.gz: f6bdb357ba0c50aaba4b30f84038378a5418112776452832b2bfa8a53313975c88ca7caea2cdc8f4701acc7206b55dab19dfd08a3eb32214e3cf53f0fa771760
6
+ metadata.gz: be10cd8868990590e93d07e97a8eb4861facbeb708fbf61a1b0b01a6aaaec8f84189a38d276d04133aeadd6aec199342dcb1be893b6a1ed19a68135c0fc9aa1d
7
+ data.tar.gz: 8c31766d217e42c06ada0cc193af5231c33d73a45b81ed62abe5a3e7c6ea11fb0e9c159d60322a242b5c9706936710390e880e0d72503911a698b10d455c38ad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 3.1.2 (January 12, 2024)
2
+
3
+ * Add Tod::TimeOfDay#to_fs for Rails 7 compatibility (Igor S. Morozov)
4
+ * Shift internally calls second_of_day instead of to_i on objects that should quack like a Tod::TimeOfDay. This makes silent errors caused by passing a bad argument less likely.
5
+
1
6
  # 3.1.1 (June 11, 2023)
2
7
 
3
8
  * Allow use in Rails forms with time_select (Bill Pearce)
data/Gemfile.lock CHANGED
@@ -1,38 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tod (3.1.0)
4
+ tod (3.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (7.0.5)
10
- activesupport (= 7.0.5)
11
- activerecord (7.0.5)
12
- activemodel (= 7.0.5)
13
- activesupport (= 7.0.5)
14
- activesupport (7.0.5)
9
+ activemodel (7.1.2)
10
+ activesupport (= 7.1.2)
11
+ activerecord (7.1.2)
12
+ activemodel (= 7.1.2)
13
+ activesupport (= 7.1.2)
14
+ timeout (>= 0.4.0)
15
+ activesupport (7.1.2)
16
+ base64
17
+ bigdecimal
15
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ connection_pool (>= 2.2.5)
20
+ drb
16
21
  i18n (>= 1.6, < 2)
17
22
  minitest (>= 5.1)
23
+ mutex_m
18
24
  tzinfo (~> 2.0)
25
+ base64 (0.2.0)
26
+ bigdecimal (3.1.5)
19
27
  byebug (11.1.3)
20
28
  coderay (1.1.3)
21
29
  concurrent-ruby (1.2.2)
30
+ connection_pool (2.4.1)
31
+ drb (2.2.0)
32
+ ruby2_keywords
22
33
  i18n (1.14.1)
23
34
  concurrent-ruby (~> 1.0)
24
35
  method_source (1.0.0)
25
- mini_portile2 (2.8.2)
26
- minitest (5.18.0)
36
+ mini_portile2 (2.8.5)
37
+ minitest (5.21.1)
38
+ mutex_m (0.2.0)
27
39
  pry (0.14.2)
28
40
  coderay (~> 1.1)
29
41
  method_source (~> 1.0)
30
42
  pry-byebug (3.10.1)
31
43
  byebug (~> 11.0)
32
44
  pry (>= 0.13, < 0.15)
33
- rake (13.0.6)
34
- sqlite3 (1.6.3)
45
+ rake (13.1.0)
46
+ ruby2_keywords (0.0.5)
47
+ sqlite3 (1.7.0)
35
48
  mini_portile2 (~> 2.8.0)
49
+ timeout (0.4.1)
36
50
  tzinfo (2.0.6)
37
51
  concurrent-ruby (~> 1.0)
38
52
 
data/lib/tod/shift.rb CHANGED
@@ -16,10 +16,10 @@ module Tod
16
16
  @ending = ending
17
17
  @exclude_end = exclude_end
18
18
 
19
- normalized_ending = ending.to_i
20
- normalized_ending += TimeOfDay::NUM_SECONDS_IN_DAY if normalized_ending < beginning.to_i
19
+ normalized_ending = ending.second_of_day
20
+ normalized_ending += TimeOfDay::NUM_SECONDS_IN_DAY if normalized_ending < beginning.second_of_day
21
21
 
22
- @range = Range.new(beginning.to_i, normalized_ending, @exclude_end)
22
+ @range = Range.new(beginning.second_of_day, normalized_ending, @exclude_end)
23
23
 
24
24
  freeze # Shift instances are value objects
25
25
  end
@@ -30,7 +30,7 @@ module Tod
30
30
 
31
31
  # Returns true if the time of day is inside the shift, false otherwise.
32
32
  def include?(tod)
33
- second = tod.to_i
33
+ second = tod.second_of_day
34
34
  second += TimeOfDay::NUM_SECONDS_IN_DAY if second < @range.first
35
35
  @range.cover?(second)
36
36
  end
@@ -107,6 +107,7 @@ module Tod
107
107
  end
108
108
  end
109
109
  alias_method :to_s, :to_formatted_s
110
+ alias_method :to_fs, :to_formatted_s
110
111
 
111
112
  def value_for_database
112
113
  to_s
data/lib/tod/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tod
2
- VERSION = "3.1.1"
2
+ VERSION = "3.1.2"
3
3
  end
@@ -190,6 +190,13 @@ describe "TimeOfDay" do
190
190
  end
191
191
  end
192
192
 
193
+ describe "to_fs" do
194
+ it "is aliased to to_formatted_s" do
195
+ t = Tod::TimeOfDay.new(8,15,30)
196
+ assert_equal t.to_formatted_s, t.to_s
197
+ end
198
+ end
199
+
193
200
  describe "inspect" do
194
201
  it "is friendly representation" do
195
202
  t = Tod::TimeOfDay.new(12,15,05)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tod
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-11 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.4.1
153
+ rubygems_version: 3.5.3
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Supplies TimeOfDay and Shift class