bank_working_day 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bank_working_day.rb +11 -0
- data/lib/bank_working_day/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7819f8bbe6e234344d9b01e486309bfac37d632
|
4
|
+
data.tar.gz: 6d6c75e5fdc5291b8345160bf65fe3405efdec7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 133a13dd9e97641e5bc75361bf48f674309b477d55dfb06b450b71045234b64627a7434f6e2ade91696124298e0e29eeb1118d6f6746da21f0419f3ca6b188f7
|
7
|
+
data.tar.gz: feda99f6e20df5a90fe4873caea9bd43b3a6c16e22ce647e15942fcbc04eeb3125685ee7142f74e3359747018319806951f74a614a197a3a52d328fed328e9f5
|
data/lib/bank_working_day.rb
CHANGED
@@ -29,6 +29,17 @@ module BankWorkingDay
|
|
29
29
|
date
|
30
30
|
end
|
31
31
|
|
32
|
+
def self.deduction_date(year: , month: , day: 27)
|
33
|
+
raise InvalidArgumentError if year.to_i.zero? || month.to_i.zero?
|
34
|
+
|
35
|
+
date = Date.new(year.to_i, month.to_i, day.to_i)
|
36
|
+
while holiday?(date)
|
37
|
+
date += 1
|
38
|
+
end
|
39
|
+
|
40
|
+
date
|
41
|
+
end
|
42
|
+
|
32
43
|
def self.holiday?(date)
|
33
44
|
holidays.holiday?(date)
|
34
45
|
end
|