stock_market_days 1.2.0 → 1.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e824858c3ddb3a1012e7500b350d828a6acc24d1dbc7c7144ba2196149f0469f
|
4
|
+
data.tar.gz: 87318b90f7aae3c0ce8533f2a1a5f814c8cb113ac2747f20a2420221294cf0b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7acc5605614dc40a2ead182d1255e333598d7705774171575d2bb1dea9cfd4abfa796a1079f9294a0eeec087d6efa0f980e5b585678f1329a892c5a038fd2f
|
7
|
+
data.tar.gz: acc414f62188c452c5a9ee2ff155fd0950c67cd02f1eee8af467be0ea4f543ee77844b4f59c98dc23a069edcf5a14e858a6046811ba364621e4e7382c3060ccd
|
data/CHANGELOG.md
CHANGED
@@ -40,12 +40,16 @@ module StockMarketDays
|
|
40
40
|
if market_days_list[begin_index] == begin_day
|
41
41
|
market_days_list[begin_index + days]
|
42
42
|
elsif market_days_list[begin_index] > begin_day
|
43
|
-
|
43
|
+
if days == 0
|
44
|
+
market_days_list[begin_index - 1]
|
45
|
+
else
|
46
|
+
offset = days > 0 ? -1 : 0
|
47
|
+
market_days_list[begin_index + offset + days]
|
48
|
+
end
|
44
49
|
else
|
45
50
|
raise "Calculator Error - This shouldn't happen in StockMarketDays#market_days_from"
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
49
|
-
|
50
54
|
end
|
51
|
-
end
|
55
|
+
end
|
@@ -211,4 +211,32 @@ describe StockMarketDays do
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
|
214
|
+
context '#previous_market_day' do
|
215
|
+
subject { described_class.previous_market_day(from_date) }
|
216
|
+
|
217
|
+
context 'on a Saturday' do
|
218
|
+
let(:from_date) { Date.new(2020,1,4) }
|
219
|
+
|
220
|
+
it { is_expected.to eql(Date.new(2020,1,3)) }
|
221
|
+
end
|
222
|
+
|
223
|
+
context 'on Labor Day' do
|
224
|
+
let(:from_date) { Date.new(2019,9,2) }
|
225
|
+
|
226
|
+
it { is_expected.to eql(Date.new(2019,8,30)) }
|
227
|
+
end
|
228
|
+
|
229
|
+
context 'on a regular trading day' do
|
230
|
+
let(:from_date) { Date.new(2019,9,5) }
|
231
|
+
|
232
|
+
it { is_expected.to eql(Date.new(2019,9,4)) }
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'on a Monday' do
|
236
|
+
let(:from_date) { Date.new(2019,9,23) }
|
237
|
+
|
238
|
+
it { is_expected.to eql(Date.new(2019,9,20)) }
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stock_market_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winston Kotzan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|