slide_rule 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slide_rule/distance_calculators/day_of_month.rb +1 -0
- data/lib/slide_rule/distance_calculators/day_of_year.rb +1 -0
- data/lib/slide_rule/version.rb +1 -1
- data/spec/slide_rule/distance_calculators/day_of_month_spec.rb +4 -0
- data/spec/slide_rule/distance_calculators/day_of_year_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15b535d71c03e3343c521cd0558bdff9c398bb9d
|
4
|
+
data.tar.gz: b520ab84e2f9dccfda40499ea471abcdf4f8ac2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960910993780635fb5c8be9a347a8d2d8932a1a70255af019cb30bba25181ca5e0905f25ff1c1fe4e7c701c49f0204c447229a4365188e0e2fd158abcf0c4b4d
|
7
|
+
data.tar.gz: 883bdb53e7575cd4ce3b2d24fa89fe05bb97898573b5351f239ec52d803a6dfcabe7f250e61b3f37753ecc31b61c2c2fc32bb07663ec87f07a58e78e38a18c8c
|
data/lib/slide_rule/version.rb
CHANGED
@@ -6,6 +6,10 @@ describe ::SlideRule::DistanceCalculators::DayOfMonth do
|
|
6
6
|
expect(described_class.new.calculate('2012-03-19', '2014-08-19')).to eq(0.0)
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should accept epoch date' do
|
10
|
+
expect(described_class.new.calculate(1_444_262_400, 1_444_262_400)).to eq(0.0)
|
11
|
+
end
|
12
|
+
|
9
13
|
it 'should calculate when date is in the same month' do
|
10
14
|
expect(described_class.new.calculate('2012-03-19', '2014-08-22')).to eq(3.0 / 15)
|
11
15
|
expect(described_class.new.calculate('2012-03-19', '2014-08-09')).to eq(10.0 / 15)
|
@@ -5,6 +5,10 @@ describe ::SlideRule::DistanceCalculators::DayOfYear do
|
|
5
5
|
it 'should return a 0 distance' do
|
6
6
|
expect(described_class.new.calculate('2015-10-8', '2015-10-8')).to eq(0.0)
|
7
7
|
end
|
8
|
+
|
9
|
+
it 'should accept epoch date' do
|
10
|
+
expect(described_class.new.calculate(1_444_262_400, 1_444_262_400)).to eq(0.0)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
context 'when dates are more than a year apart' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slide_rule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mattnichols
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
12
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: vladlev
|