activerecord-time 0.14.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 +18 -14
- data/.rubocop_todo.yml +62 -30
- data/.travis.yml +6 -4
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/activerecord-time.gemspec +3 -3
- data/gemfiles/ar60.gemfile +3 -0
- data/gemfiles/ar60.gemfile.lock +75 -0
- data/gemfiles/ar61.gemfile +3 -0
- data/gemfiles/common.gemfile +1 -1
- data/lib/activerecord-time/version.rb +1 -1
- data/lib/time_of_day.rb +27 -4
- data/matrix_test.rb +7 -1
- data/test/test_helper.rb +0 -2
- data/test/time_of_day_test.rb +27 -1
- metadata +17 -14
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
@@ -2,32 +2,35 @@ inherit_from: .rubocop_todo.yml
|
|
2
2
|
require:
|
3
3
|
- rubocop-performance
|
4
4
|
- rubocop-rails
|
5
|
+
- rubocop-rake
|
5
6
|
|
6
7
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.4
|
8
8
|
DisplayCopNames: true
|
9
9
|
DisplayStyleGuide: true
|
10
|
+
NewCops: enable
|
10
11
|
Include:
|
11
12
|
- '**/Gemfile'
|
12
13
|
- '**/Rakefile'
|
13
14
|
- '**/*.rb'
|
14
15
|
|
15
|
-
Layout/
|
16
|
-
EnforcedStyle: with_fixed_indentation
|
16
|
+
Layout/AssignmentIndentation:
|
17
17
|
IndentationWidth: 4
|
18
18
|
|
19
|
-
Layout/
|
19
|
+
Layout/FirstArgumentIndentation:
|
20
20
|
EnforcedStyle: consistent
|
21
21
|
IndentationWidth: 4
|
22
22
|
|
23
|
-
Layout/
|
23
|
+
Layout/FirstArrayElementIndentation:
|
24
24
|
EnforcedStyle: consistent
|
25
25
|
|
26
|
-
Layout/
|
26
|
+
Layout/FirstHashElementIndentation:
|
27
27
|
EnforcedStyle: consistent
|
28
28
|
|
29
|
-
Layout/
|
30
|
-
|
29
|
+
Layout/LineLength:
|
30
|
+
Max: 107
|
31
|
+
AllowHeredoc: true
|
32
|
+
AllowURI: true
|
33
|
+
IgnoreCopDirectives: true
|
31
34
|
|
32
35
|
Layout/MultilineMethodCallIndentation:
|
33
36
|
EnforcedStyle: indented
|
@@ -37,16 +40,14 @@ Layout/MultilineOperationIndentation:
|
|
37
40
|
EnforcedStyle: indented
|
38
41
|
IndentationWidth: 4
|
39
42
|
|
43
|
+
Layout/ParameterAlignment:
|
44
|
+
EnforcedStyle: with_fixed_indentation
|
45
|
+
IndentationWidth: 4
|
46
|
+
|
40
47
|
Metrics/BlockLength:
|
41
48
|
Exclude:
|
42
49
|
- '*.gemspec'
|
43
50
|
|
44
|
-
Metrics/LineLength:
|
45
|
-
Max: 107
|
46
|
-
AllowHeredoc: true
|
47
|
-
AllowURI: true
|
48
|
-
IgnoreCopDirectives: true
|
49
|
-
|
50
51
|
Naming/FileName:
|
51
52
|
Exclude:
|
52
53
|
- 'activerecord-time.gemspec'
|
@@ -68,6 +69,9 @@ Style/Encoding:
|
|
68
69
|
Style/FormatString:
|
69
70
|
EnforcedStyle: percent
|
70
71
|
|
72
|
+
Style/FormatStringToken:
|
73
|
+
EnforcedStyle: unannotated
|
74
|
+
|
71
75
|
Style/NumericPredicate:
|
72
76
|
Enabled: false
|
73
77
|
|
data/.rubocop_todo.yml
CHANGED
@@ -1,42 +1,72 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
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
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 1
|
10
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
11
|
+
Exclude:
|
12
|
+
- 'test/time_of_day_test.rb'
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
16
|
+
Lint/DuplicateBranch:
|
17
|
+
Exclude:
|
18
|
+
- 'lib/time_of_day.rb'
|
19
|
+
|
9
20
|
# Offense count: 3
|
21
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
10
22
|
Metrics/AbcSize:
|
11
|
-
Max:
|
23
|
+
Max: 31
|
12
24
|
|
13
25
|
# Offense count: 1
|
14
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
-
#
|
26
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
27
|
+
# IgnoredMethods: refine
|
16
28
|
Metrics/BlockLength:
|
17
29
|
Max: 28
|
18
30
|
|
19
|
-
# Offense count:
|
20
|
-
# Configuration parameters: CountComments.
|
31
|
+
# Offense count: 2
|
32
|
+
# Configuration parameters: CountComments, CountAsOne.
|
21
33
|
Metrics/ClassLength:
|
22
|
-
Max:
|
34
|
+
Max: 174
|
23
35
|
|
24
36
|
# Offense count: 1
|
37
|
+
# Configuration parameters: IgnoredMethods.
|
25
38
|
Metrics/CyclomaticComplexity:
|
26
|
-
Max:
|
39
|
+
Max: 10
|
27
40
|
|
28
|
-
# Offense count:
|
29
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
41
|
+
# Offense count: 3
|
42
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
30
43
|
Metrics/MethodLength:
|
31
|
-
Max:
|
44
|
+
Max: 13
|
32
45
|
|
33
46
|
# Offense count: 1
|
34
|
-
# Configuration parameters:
|
47
|
+
# Configuration parameters: IgnoredMethods.
|
48
|
+
Metrics/PerceivedComplexity:
|
49
|
+
Max: 11
|
50
|
+
|
51
|
+
# Offense count: 2
|
52
|
+
# Configuration parameters: EnforcedStyle, AllowToTime.
|
35
53
|
# SupportedStyles: strict, flexible
|
36
54
|
Rails/Date:
|
37
55
|
Exclude:
|
38
56
|
- 'lib/time_of_day.rb'
|
39
57
|
|
58
|
+
# Offense count: 1
|
59
|
+
# Cop supports --auto-correct.
|
60
|
+
Rails/WhereEquals:
|
61
|
+
Exclude:
|
62
|
+
- 'test/time_of_day_test.rb'
|
63
|
+
|
64
|
+
# Offense count: 1
|
65
|
+
# Cop supports --auto-correct.
|
66
|
+
Rails/WhereNot:
|
67
|
+
Exclude:
|
68
|
+
- 'test/time_of_day_test.rb'
|
69
|
+
|
40
70
|
# Offense count: 2
|
41
71
|
# Cop supports --auto-correct.
|
42
72
|
Security/YAMLLoad:
|
@@ -45,35 +75,37 @@ Security/YAMLLoad:
|
|
45
75
|
- 'test/time_of_day_test.rb'
|
46
76
|
|
47
77
|
# Offense count: 1
|
48
|
-
# Configuration parameters: .
|
78
|
+
# Configuration parameters: AllowModifiersOnSymbols.
|
49
79
|
# SupportedStyles: inline, group
|
50
80
|
Style/AccessModifierDeclarations:
|
51
81
|
EnforcedStyle: inline
|
52
82
|
|
83
|
+
# Offense count: 3
|
84
|
+
# Cop supports --auto-correct.
|
85
|
+
# Configuration parameters: EnforcedStyle.
|
86
|
+
# SupportedStyles: separated, grouped
|
87
|
+
Style/AccessorGrouping:
|
88
|
+
Exclude:
|
89
|
+
- 'lib/time_of_day.rb'
|
90
|
+
|
53
91
|
# Offense count: 1
|
54
92
|
# Cop supports --auto-correct.
|
55
|
-
# Configuration parameters:
|
93
|
+
# Configuration parameters: EnforcedStyle.
|
56
94
|
# SupportedStyles: nested, compact
|
57
95
|
Style/ClassAndModuleChildren:
|
58
96
|
Exclude:
|
59
97
|
- 'lib/time_of_day/core_ext.rb'
|
60
98
|
|
61
|
-
# Offense count:
|
62
|
-
# Configuration parameters: .
|
63
|
-
#
|
64
|
-
Style/
|
65
|
-
EnforcedStyle: unannotated
|
66
|
-
|
67
|
-
# Offense count: 2
|
68
|
-
# Cop supports --auto-correct.
|
69
|
-
# Configuration parameters: EnforcedStyle.
|
70
|
-
# SupportedStyles: always, never
|
71
|
-
Style/FrozenStringLiteralComment:
|
99
|
+
# Offense count: 1
|
100
|
+
# Configuration parameters: AllowedMethods.
|
101
|
+
# AllowedMethods: respond_to_missing?
|
102
|
+
Style/OptionalBooleanParameter:
|
72
103
|
Exclude:
|
73
|
-
- '
|
74
|
-
- 'Rakefile'
|
104
|
+
- 'lib/time_of_day.rb'
|
75
105
|
|
76
|
-
# Offense count:
|
77
|
-
|
106
|
+
# Offense count: 5
|
107
|
+
# Cop supports --auto-correct.
|
108
|
+
# Configuration parameters: Mode.
|
109
|
+
Style/StringConcatenation:
|
78
110
|
Exclude:
|
79
|
-
- 'test/
|
111
|
+
- 'test/test_helper.rb'
|
data/.travis.yml
CHANGED
@@ -4,13 +4,16 @@ cache: bundler
|
|
4
4
|
services:
|
5
5
|
- postgresql
|
6
6
|
jdk:
|
7
|
-
-
|
7
|
+
- openjdk11
|
8
8
|
rvm:
|
9
|
+
- ruby-3.0
|
10
|
+
- ruby-2.7
|
9
11
|
- ruby-2.6
|
10
12
|
- ruby-2.5
|
11
|
-
- ruby-2.4
|
12
13
|
- jruby
|
13
14
|
gemfile:
|
15
|
+
- gemfiles/ar61.gemfile
|
16
|
+
- gemfiles/ar60.gemfile
|
14
17
|
- gemfiles/ar52.gemfile
|
15
18
|
- gemfiles/ar51.gemfile
|
16
19
|
env:
|
@@ -23,5 +26,4 @@ matrix:
|
|
23
26
|
allow_failures:
|
24
27
|
- rvm: jruby
|
25
28
|
env: ADAPTER="sqlite3"
|
26
|
-
- rvm:
|
27
|
-
env: ADAPTER="sqlite3"
|
29
|
+
- rvm: ruby-2.7
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/activerecord-time.gemspec
CHANGED
@@ -16,14 +16,14 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.summary = 'A handler for storing TimeOfDay objects in ActiveRecord objects as sql time values.'
|
17
17
|
gem.homepage = 'https://github.com/donv/activerecord-time'
|
18
18
|
gem.license = 'MIT'
|
19
|
-
gem.required_ruby_version = '>= 2.
|
19
|
+
gem.required_ruby_version = '>= 2.5'
|
20
20
|
|
21
21
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
22
22
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
23
23
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
24
24
|
gem.require_paths = %w[lib]
|
25
25
|
|
26
|
-
gem.add_runtime_dependency 'activerecord', '>=5.1', '<
|
26
|
+
gem.add_runtime_dependency 'activerecord', '>=5.1', '<7'
|
27
27
|
|
28
28
|
if defined? JRUBY_VERSION
|
29
29
|
gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter'
|
@@ -32,10 +32,10 @@ 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'
|
39
38
|
gem.add_development_dependency 'rubocop-rails'
|
39
|
+
gem.add_development_dependency 'rubocop-rake'
|
40
40
|
gem.add_development_dependency 'simplecov'
|
41
41
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (6.0.2.1)
|
5
|
+
activesupport (= 6.0.2.1)
|
6
|
+
activerecord (6.0.2.1)
|
7
|
+
activemodel (= 6.0.2.1)
|
8
|
+
activesupport (= 6.0.2.1)
|
9
|
+
activerecord-jdbc-adapter (60.1-java)
|
10
|
+
activerecord (~> 6.0.0)
|
11
|
+
activerecord-jdbcderby-adapter (0.8.2)
|
12
|
+
activerecord-jdbc-adapter (>= 0.8.2)
|
13
|
+
jdbc-derby (>= 10.3.2.1)
|
14
|
+
activerecord-jdbcpostgresql-adapter (60.1-java)
|
15
|
+
activerecord-jdbc-adapter (= 60.1)
|
16
|
+
jdbc-postgres (>= 9.4, < 43)
|
17
|
+
activerecord-jdbcsqlite3-adapter (60.1-java)
|
18
|
+
activerecord-jdbc-adapter (= 60.1)
|
19
|
+
jdbc-sqlite3 (~> 3.8, < 3.30)
|
20
|
+
activesupport (6.0.2.1)
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
+
i18n (>= 0.7, < 2)
|
23
|
+
minitest (~> 5.1)
|
24
|
+
tzinfo (~> 1.1)
|
25
|
+
zeitwerk (~> 2.2)
|
26
|
+
ansi (1.5.0)
|
27
|
+
builder (3.2.4)
|
28
|
+
concurrent-ruby (1.1.5)
|
29
|
+
docile (1.3.2)
|
30
|
+
i18n (1.7.0)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
jdbc-derby (10.12.1.1)
|
33
|
+
jdbc-postgres (42.2.6)
|
34
|
+
jdbc-sqlite3 (3.28.0)
|
35
|
+
json (2.3.0)
|
36
|
+
json (2.3.0-java)
|
37
|
+
minitest (5.13.0)
|
38
|
+
minitest-reporters (1.4.2)
|
39
|
+
ansi
|
40
|
+
builder
|
41
|
+
minitest (>= 5.0)
|
42
|
+
ruby-progressbar
|
43
|
+
pg (0.21.0)
|
44
|
+
rake (13.0.1)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
simplecov (0.17.1)
|
47
|
+
docile (~> 1.1)
|
48
|
+
json (>= 1.8, < 3)
|
49
|
+
simplecov-html (~> 0.10.0)
|
50
|
+
simplecov-html (0.10.2)
|
51
|
+
sqlite3 (1.4.2)
|
52
|
+
thread_safe (0.3.6)
|
53
|
+
thread_safe (0.3.6-java)
|
54
|
+
tzinfo (1.2.6)
|
55
|
+
thread_safe (~> 0.1)
|
56
|
+
zeitwerk (2.2.2)
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
java
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
activerecord (~> 6.0.0)
|
64
|
+
activerecord-jdbc-adapter
|
65
|
+
activerecord-jdbcderby-adapter
|
66
|
+
activerecord-jdbcpostgresql-adapter
|
67
|
+
activerecord-jdbcsqlite3-adapter
|
68
|
+
minitest-reporters
|
69
|
+
pg (< 1)
|
70
|
+
rake
|
71
|
+
simplecov
|
72
|
+
sqlite3
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
1.17.2
|
data/gemfiles/common.gemfile
CHANGED
data/lib/time_of_day.rb
CHANGED
@@ -11,7 +11,9 @@ class TimeOfDay
|
|
11
11
|
|
12
12
|
def initialize(hour, minute = 0, second = 0)
|
13
13
|
if hour == 24
|
14
|
-
|
14
|
+
unless minute == 0 && second == 0
|
15
|
+
raise "Invalid TimeOfDay. #{hour}:#{minute}:#{second} given, but highest allowed value is 24:00:00"
|
16
|
+
end
|
15
17
|
else
|
16
18
|
raise "Invalid hour: #{hour}" unless hour >= 0 && hour <= 23
|
17
19
|
end
|
@@ -85,9 +87,15 @@ class TimeOfDay
|
|
85
87
|
end
|
86
88
|
|
87
89
|
def -(other)
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
91
99
|
end
|
92
100
|
|
93
101
|
def <=>(other)
|
@@ -104,6 +112,17 @@ class TimeOfDay
|
|
104
112
|
to_a <=> [other_tod.hour, other_tod.minute, other_tod.second]
|
105
113
|
end
|
106
114
|
|
115
|
+
# Referring to the same H/M/S makes objects equal.
|
116
|
+
# and we only want one hash key.
|
117
|
+
def hash
|
118
|
+
@hour.hash ^ @minute.hash ^ @second.hash
|
119
|
+
end
|
120
|
+
|
121
|
+
# Referring to the same H/M/S makes objects equal.
|
122
|
+
def eql?(other)
|
123
|
+
hash == other.hash
|
124
|
+
end
|
125
|
+
|
107
126
|
def strftime(format)
|
108
127
|
on(Date.today).strftime(format)
|
109
128
|
end
|
@@ -118,6 +137,10 @@ class TimeOfDay
|
|
118
137
|
"#{@hour.inspect}:#{@minute.inspect}:#{@second.inspect}"
|
119
138
|
end
|
120
139
|
|
140
|
+
def inspect
|
141
|
+
"#<#{self.class} hour=#{@hour}, minute=#{@minute}, second=#{@second}>"
|
142
|
+
end
|
143
|
+
|
121
144
|
def to_a
|
122
145
|
[@hour, @minute, @second]
|
123
146
|
end
|
data/matrix_test.rb
CHANGED
@@ -38,6 +38,12 @@ end
|
|
38
38
|
|
39
39
|
bad_variants = (travis.dig('matrix', 'exclude').to_a + travis.dig('matrix', 'allow_failures').to_a)
|
40
40
|
|
41
|
+
travis['env']['global'].each do |env|
|
42
|
+
env.scan(/\b(?<key>[A-Z_]+)="(?<value>.+?)"/) do |key, value|
|
43
|
+
ENV[key] = value
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
41
47
|
travis['rvm'].each do |ruby|
|
42
48
|
next if /head/.match?(ruby) # ruby-install does not support HEAD installation
|
43
49
|
|
@@ -53,7 +59,7 @@ travis['rvm'].each do |ruby|
|
|
53
59
|
system "#{bundler_gem_check_cmd} || #{bundler_install_cmd}" || exit(1)
|
54
60
|
travis['gemfile'].each do |gemfile|
|
55
61
|
use_gemfile(ruby, gemfile, update_gemfiles) do
|
56
|
-
travis['env'].each do |env|
|
62
|
+
travis['env']['matrix'].each do |env|
|
57
63
|
bad_variant = bad_variants.any? do |f|
|
58
64
|
(f['rvm'].nil? || f['rvm'] == ruby) &&
|
59
65
|
(f['gemfile'].nil? || f['gemfile'] == gemfile) && (f['env'].nil? || f['env'] == env)
|
data/test/test_helper.rb
CHANGED
data/test/time_of_day_test.rb
CHANGED
@@ -5,6 +5,7 @@ require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
5
5
|
class ApplicationRecord < ActiveRecord::Base
|
6
6
|
self.abstract_class = true
|
7
7
|
end
|
8
|
+
|
8
9
|
class Event < ApplicationRecord
|
9
10
|
end
|
10
11
|
|
@@ -141,6 +142,16 @@ class TimeOfDayTest < Minitest::Test
|
|
141
142
|
assert_equal 59, tod.second
|
142
143
|
end
|
143
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
|
+
|
144
155
|
def test_equality
|
145
156
|
tod1 = TimeOfDay.new(12, 0, 5)
|
146
157
|
tod2 = TimeOfDay.new(12, 0, 5)
|
@@ -154,7 +165,7 @@ class TimeOfDayTest < Minitest::Test
|
|
154
165
|
tod2 = TimeOfDay.new(13, 0)
|
155
166
|
assert_equal(-1, tod1 <=> tod2)
|
156
167
|
assert_equal 1, tod2 <=> tod1
|
157
|
-
assert_equal 0, tod1 <=> tod1
|
168
|
+
assert_equal 0, tod1 <=> tod1
|
158
169
|
end
|
159
170
|
|
160
171
|
def test_strftime
|
@@ -201,4 +212,19 @@ class TimeOfDayTest < Minitest::Test
|
|
201
212
|
tod = TimeOfDay.new(12, 13)
|
202
213
|
assert_equal '"12:13:00"', tod.to_json('foo')
|
203
214
|
end
|
215
|
+
|
216
|
+
def test_eql?
|
217
|
+
a = TimeOfDay.new(10, 11, 12)
|
218
|
+
b = TimeOfDay.new(10, 11, 12)
|
219
|
+
assert a.eql?(b)
|
220
|
+
assert_equal a.hash, b.hash
|
221
|
+
hashmap = {}
|
222
|
+
hashmap[a] = 'foo'
|
223
|
+
hashmap[b] = 'bar'
|
224
|
+
assert_equal hashmap, TimeOfDay.new(10, 11, 12) => 'bar'
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_inspect
|
228
|
+
assert_equal '#<TimeOfDay hour=10, minute=11, second=12>', TimeOfDay.new(10, 11, 12).inspect
|
229
|
+
end
|
204
230
|
end
|
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
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pg
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: rubocop
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name: rubocop
|
90
|
+
name: rubocop-performance
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
@@ -101,7 +101,7 @@ dependencies:
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name: rubocop-
|
104
|
+
name: rubocop-rails
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name: rubocop-
|
118
|
+
name: rubocop-rake
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -164,6 +164,9 @@ files:
|
|
164
164
|
- gemfiles/ar51.gemfile.lock
|
165
165
|
- gemfiles/ar52.gemfile
|
166
166
|
- gemfiles/ar52.gemfile.lock
|
167
|
+
- gemfiles/ar60.gemfile
|
168
|
+
- gemfiles/ar60.gemfile.lock
|
169
|
+
- gemfiles/ar61.gemfile
|
167
170
|
- gemfiles/common.gemfile
|
168
171
|
- lib/activerecord-time.rb
|
169
172
|
- lib/activerecord-time/extension.rb
|
@@ -179,7 +182,7 @@ homepage: https://github.com/donv/activerecord-time
|
|
179
182
|
licenses:
|
180
183
|
- MIT
|
181
184
|
metadata: {}
|
182
|
-
post_install_message:
|
185
|
+
post_install_message:
|
183
186
|
rdoc_options: []
|
184
187
|
require_paths:
|
185
188
|
- lib
|
@@ -187,15 +190,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
190
|
requirements:
|
188
191
|
- - ">="
|
189
192
|
- !ruby/object:Gem::Version
|
190
|
-
version: '2.
|
193
|
+
version: '2.5'
|
191
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
195
|
requirements:
|
193
196
|
- - ">="
|
194
197
|
- !ruby/object:Gem::Version
|
195
198
|
version: '0'
|
196
199
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
-
signing_key:
|
200
|
+
rubygems_version: 3.2.22
|
201
|
+
signing_key:
|
199
202
|
specification_version: 4
|
200
203
|
summary: A handler for storing TimeOfDay objects in ActiveRecord objects as sql time
|
201
204
|
values.
|