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 +4 -4
- data/.rubocop_todo.yml +1 -1
- data/.travis.yml +1 -2
- data/gemfiles/ar60.gemfile.lock +17 -0
- data/lib/activerecord-time/version.rb +1 -1
- data/lib/time_of_day.rb +15 -0
- data/test/time_of_day_test.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7976fe7965349b4caeeb182906f8779e9644b8512d74290fd8c405e5655326
|
4
|
+
data.tar.gz: 7591baed02bf325a82dd2afa9b77a4ed911035167e2c4bd05a0e53646c5e7b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1187f665dcfb31db2508e836b4995b3047dec8e400fac53dec0a6de2841f73a30dc391d6b8f69a646771d5408acfa0ddb5a58a12bf309b2067716a8481937719
|
7
|
+
data.tar.gz: 78259bc4b3fb7279a14137857129060e3074f344c227742890e2f0a68b83b486cb72d8701518aafc1262f9ee840d725503fe351bb4bb5ab9433ceeb659eab0c0
|
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
data/gemfiles/ar60.gemfile.lock
CHANGED
@@ -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
|
data/lib/time_of_day.rb
CHANGED
@@ -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
|
data/test/time_of_day_test.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|