activerecord-time 0.17.0 → 0.18.0
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 +4 -4
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +6 -5
- data/.travis.yml +3 -1
- data/activerecord-time.gemspec +0 -1
- data/lib/activerecord-time/version.rb +1 -1
- data/lib/time_of_day.rb +9 -3
- data/test/test_helper.rb +0 -2
- data/test/time_of_day_test.rb +10 -0
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b52c52ad34414185dbadd7b54be0d7dbfc2b9be326581d7102fe1ce713eff2
|
4
|
+
data.tar.gz: '04965d38dce4fa1a2510725f4626f7796d2e23e0a7a9597535f6b212b8058b46'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3f7975838214c58b8c7970c3951b1be99f14b1dea449f30c1ab63370ab196cc352fff4dde07c99d848f04e49e3f9d9ca1c148545e457a9293100fab97cd7bb
|
7
|
+
data.tar.gz: a64a1dd1ffccccf70699318117503f67841f59b4c54e8c36f8d7fadd01169130a921a027e8800f6173b3387487b54d08c6ca0a91749b0c679d39274b0f6fd921
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-
|
3
|
+
# on 2021-11-25 10:12:00 UTC using RuboCop version 1.23.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -26,12 +26,12 @@ Metrics/AbcSize:
|
|
26
26
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
27
27
|
# IgnoredMethods: refine
|
28
28
|
Metrics/BlockLength:
|
29
|
-
Max:
|
29
|
+
Max: 28
|
30
30
|
|
31
31
|
# Offense count: 2
|
32
32
|
# Configuration parameters: CountComments, CountAsOne.
|
33
33
|
Metrics/ClassLength:
|
34
|
-
Max:
|
34
|
+
Max: 174
|
35
35
|
|
36
36
|
# Offense count: 1
|
37
37
|
# Configuration parameters: IgnoredMethods.
|
@@ -41,7 +41,7 @@ Metrics/CyclomaticComplexity:
|
|
41
41
|
# Offense count: 3
|
42
42
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
43
43
|
Metrics/MethodLength:
|
44
|
-
Max:
|
44
|
+
Max: 13
|
45
45
|
|
46
46
|
# Offense count: 1
|
47
47
|
# Configuration parameters: IgnoredMethods.
|
@@ -49,7 +49,7 @@ Metrics/PerceivedComplexity:
|
|
49
49
|
Max: 11
|
50
50
|
|
51
51
|
# Offense count: 2
|
52
|
-
# Configuration parameters: EnforcedStyle.
|
52
|
+
# Configuration parameters: EnforcedStyle, AllowToTime.
|
53
53
|
# SupportedStyles: strict, flexible
|
54
54
|
Rails/Date:
|
55
55
|
Exclude:
|
@@ -105,6 +105,7 @@ Style/OptionalBooleanParameter:
|
|
105
105
|
|
106
106
|
# Offense count: 5
|
107
107
|
# Cop supports --auto-correct.
|
108
|
+
# Configuration parameters: Mode.
|
108
109
|
Style/StringConcatenation:
|
109
110
|
Exclude:
|
110
111
|
- 'test/test_helper.rb'
|
data/.travis.yml
CHANGED
@@ -4,13 +4,15 @@ cache: bundler
|
|
4
4
|
services:
|
5
5
|
- postgresql
|
6
6
|
jdk:
|
7
|
-
-
|
7
|
+
- openjdk11
|
8
8
|
rvm:
|
9
|
+
- ruby-3.0
|
9
10
|
- ruby-2.7
|
10
11
|
- ruby-2.6
|
11
12
|
- ruby-2.5
|
12
13
|
- jruby
|
13
14
|
gemfile:
|
15
|
+
- gemfiles/ar61.gemfile
|
14
16
|
- gemfiles/ar60.gemfile
|
15
17
|
- gemfiles/ar52.gemfile
|
16
18
|
- gemfiles/ar51.gemfile
|
data/activerecord-time.gemspec
CHANGED
@@ -32,7 +32,6 @@ Gem::Specification.new do |gem|
|
|
32
32
|
gem.add_development_dependency 'pg'
|
33
33
|
gem.add_development_dependency 'sqlite3'
|
34
34
|
end
|
35
|
-
gem.add_development_dependency 'minitest-reporters'
|
36
35
|
gem.add_development_dependency 'rake'
|
37
36
|
gem.add_development_dependency 'rubocop'
|
38
37
|
gem.add_development_dependency 'rubocop-performance'
|
data/lib/time_of_day.rb
CHANGED
@@ -87,9 +87,15 @@ class TimeOfDay
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def -(other)
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
if other.is_a?(TimeOfDay)
|
91
|
+
t1 = Time.local(0, 1, 1, hour, minute, second) # rubocop: disable Rails/TimeZone
|
92
|
+
t2 = Time.local(0, 1, 1, other.hour, other.minute, other.second) # rubocop: disable Rails/TimeZone
|
93
|
+
(t1 - t2).seconds
|
94
|
+
elsif other.is_a?(Numeric)
|
95
|
+
self.+(-other)
|
96
|
+
else
|
97
|
+
raise "Illegal argument: #{other.inspect}"
|
98
|
+
end
|
93
99
|
end
|
94
100
|
|
95
101
|
def <=>(other)
|
data/test/test_helper.rb
CHANGED
data/test/time_of_day_test.rb
CHANGED
@@ -142,6 +142,16 @@ class TimeOfDayTest < Minitest::Test
|
|
142
142
|
assert_equal 59, tod.second
|
143
143
|
end
|
144
144
|
|
145
|
+
def test_minus_tod
|
146
|
+
tod1 = TimeOfDay.new(12, 0, 29)
|
147
|
+
tod2 = TimeOfDay.new(13, 30, 59)
|
148
|
+
duration = tod2 - tod1
|
149
|
+
|
150
|
+
assert_equal 1, duration.in_hours.to_i
|
151
|
+
assert_equal 30, duration.in_minutes.to_i % 60
|
152
|
+
assert_equal 30, duration.in_seconds % 60
|
153
|
+
end
|
154
|
+
|
145
155
|
def test_equality
|
146
156
|
tod1 = TimeOfDay.new(12, 0, 5)
|
147
157
|
tod2 = TimeOfDay.new(12, 0, 5)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -58,20 +58,6 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: minitest-reporters
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
62
|
name: rake
|
77
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
197
|
- !ruby/object:Gem::Version
|
212
198
|
version: '0'
|
213
199
|
requirements: []
|
214
|
-
rubygems_version: 3.2.
|
200
|
+
rubygems_version: 3.2.22
|
215
201
|
signing_key:
|
216
202
|
specification_version: 4
|
217
203
|
summary: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time
|