activerecord-time 0.15.0 → 0.16.0

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: 74b38dd8f2d4999899987300708ad5021513b9d40c86384ac5861fb1a4546c27
4
- data.tar.gz: acbf8503d6ebd62b25847a0e79e5869d9e1d500283d1e12bf8270f3c16b77258
3
+ metadata.gz: bf7976fe7965349b4caeeb182906f8779e9644b8512d74290fd8c405e5655326
4
+ data.tar.gz: 7591baed02bf325a82dd2afa9b77a4ed911035167e2c4bd05a0e53646c5e7b25
5
5
  SHA512:
6
- metadata.gz: a3edf4d01502a7d0122742b93a1bbe2d9f02dee49ea9faa17c4ef4734d3c3cd4d88b6db459eac9c3719fc1533f08a034a578a68dc3187d7b7e1f3d06fd890c2b
7
- data.tar.gz: 5e558c393d397014d8ca13b48e10c0981bbfcb6d8b6f3ec0183eda38495476b1bdc146c836e4bfd37f97f767e5f5eab99236f08bd886f3e5ec8438ac659d009b
6
+ metadata.gz: 1187f665dcfb31db2508e836b4995b3047dec8e400fac53dec0a6de2841f73a30dc391d6b8f69a646771d5408acfa0ddb5a58a12bf309b2067716a8481937719
7
+ data.tar.gz: 78259bc4b3fb7279a14137857129060e3074f344c227742890e2f0a68b83b486cb72d8701518aafc1262f9ee840d725503fe351bb4bb5ab9433ceeb659eab0c0
@@ -19,7 +19,7 @@ Metrics/BlockLength:
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments.
21
21
  Metrics/ClassLength:
22
- Max: 161
22
+ Max: 176
23
23
 
24
24
  # Offense count: 1
25
25
  Metrics/CyclomaticComplexity:
@@ -24,5 +24,4 @@ matrix:
24
24
  allow_failures:
25
25
  - rvm: jruby
26
26
  env: ADAPTER="sqlite3"
27
- - rvm: jruby
28
- env: ADAPTER="sqlite3"
27
+ - rvm: ruby-2.7
@@ -6,6 +6,17 @@ GEM
6
6
  activerecord (6.0.2.1)
7
7
  activemodel (= 6.0.2.1)
8
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)
9
20
  activesupport (6.0.2.1)
10
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
11
22
  i18n (>= 0.7, < 2)
@@ -18,7 +29,11 @@ GEM
18
29
  docile (1.3.2)
19
30
  i18n (1.7.0)
20
31
  concurrent-ruby (~> 1.0)
32
+ jdbc-derby (10.12.1.1)
33
+ jdbc-postgres (42.2.6)
34
+ jdbc-sqlite3 (3.28.0)
21
35
  json (2.3.0)
36
+ json (2.3.0-java)
22
37
  minitest (5.13.0)
23
38
  minitest-reporters (1.4.2)
24
39
  ansi
@@ -35,11 +50,13 @@ GEM
35
50
  simplecov-html (0.10.2)
36
51
  sqlite3 (1.4.2)
37
52
  thread_safe (0.3.6)
53
+ thread_safe (0.3.6-java)
38
54
  tzinfo (1.2.6)
39
55
  thread_safe (~> 0.1)
40
56
  zeitwerk (2.2.2)
41
57
 
42
58
  PLATFORMS
59
+ java
43
60
  ruby
44
61
 
45
62
  DEPENDENCIES
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Activerecord
4
4
  module Time
5
- VERSION = '0.15.0'
5
+ VERSION = '0.16.0'
6
6
  end
7
7
  end
@@ -106,6 +106,17 @@ class TimeOfDay
106
106
  to_a <=> [other_tod.hour, other_tod.minute, other_tod.second]
107
107
  end
108
108
 
109
+ # Referring to the same H/M/S makes objects equal.
110
+ # and we only want one hash key.
111
+ def hash
112
+ @hour.hash ^ @minute.hash ^ @second.hash
113
+ end
114
+
115
+ # Referring to the same H/M/S makes objects equal.
116
+ def eql?(other)
117
+ hash == other.hash
118
+ end
119
+
109
120
  def strftime(format)
110
121
  on(Date.today).strftime(format)
111
122
  end
@@ -120,6 +131,10 @@ class TimeOfDay
120
131
  "#{@hour.inspect}:#{@minute.inspect}:#{@second.inspect}"
121
132
  end
122
133
 
134
+ def inspect
135
+ "#<#{self.class} hour=#{@hour}, minute=#{@minute}, second=#{@second}>"
136
+ end
137
+
123
138
  def to_a
124
139
  [@hour, @minute, @second]
125
140
  end
@@ -201,4 +201,21 @@ class TimeOfDayTest < Minitest::Test
201
201
  tod = TimeOfDay.new(12, 13)
202
202
  assert_equal '"12:13:00"', tod.to_json('foo')
203
203
  end
204
+
205
+ def test_eql?
206
+ a = TimeOfDay.new(10, 11, 12)
207
+ b = TimeOfDay.new(10, 11, 12)
208
+ assert a.eql?(b)
209
+ assert_equal a.hash, b.hash
210
+ hashmap = {}
211
+ hashmap[a] = 'foo'
212
+ hashmap[b] = 'bar'
213
+ assert_equal hashmap, TimeOfDay.new(10, 11, 12) => 'bar'
214
+ end
215
+
216
+ def test_inspect
217
+ a = TimeOfDay.new(10, 11, 12)
218
+ p a.inspect
219
+ assert_equal a.inspect, '#<TimeOfDay hour=10, minute=11, second=12>'
220
+ end
204
221
  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.15.0
4
+ version: 0.16.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: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord