fat_period 1.1.1 → 1.2.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/lib/fat_period/period.rb +17 -2
- data/lib/fat_period/version.rb +1 -1
- 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: 7a36af9ab31a0faffb0b9128748deb78fa97b8cb56581bcf3b47b8a2a8776d29
|
4
|
+
data.tar.gz: '089e00bbce43fe66642ef419c9824fab84ab3a6b36aecc586aeb383662c10aa2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ebcd8b723bd5f95845acf7ecd831293f88ccd15b31caec79d23e1e4bf308d49b02c43556ff85eaebbe9b31d28c683c5cb5dec1418ebfa2f2758790206d731c
|
7
|
+
data.tar.gz: 7e19c54d5e179b20ff715e28b2ae191ada78ee75553832b07b48b3bba82ea617494208de44ae18900f45258ffb0de7be60fd5beadf200a7182921f690aebd9a7
|
data/lib/fat_period/period.rb
CHANGED
@@ -29,8 +29,9 @@ class Period
|
|
29
29
|
# @raise [ArgumentError] if first date is later than last date
|
30
30
|
# @return [Period]
|
31
31
|
def initialize(first, last)
|
32
|
-
@first = Date.ensure_date(first)
|
33
|
-
@last = Date.ensure_date(last)
|
32
|
+
@first = Date.ensure_date(first).freeze
|
33
|
+
@last = Date.ensure_date(last).freeze
|
34
|
+
freeze
|
34
35
|
|
35
36
|
return unless @first > @last
|
36
37
|
|
@@ -180,6 +181,20 @@ class Period
|
|
180
181
|
!(self == other)
|
181
182
|
end
|
182
183
|
|
184
|
+
# Return the hash value for this Period. Make Period's with identical
|
185
|
+
# values test eql? so that they may be used as hash keys.
|
186
|
+
#
|
187
|
+
# @return [Integer]
|
188
|
+
def hash
|
189
|
+
(first.hash | last.hash)
|
190
|
+
end
|
191
|
+
|
192
|
+
def eql?(other)
|
193
|
+
return nil unless other.is_a?(Period)
|
194
|
+
|
195
|
+
hash == other.hash
|
196
|
+
end
|
197
|
+
|
183
198
|
# Return whether this Period contains the given date.
|
184
199
|
#
|
185
200
|
# @param date [Date] date to test
|
data/lib/fat_period/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_period
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|