us_bank_holidays 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/us_bank_holidays.rb +10 -0
- data/lib/us_bank_holidays/version.rb +1 -1
- data/spec/functional/us_bank_holidays_spec.rb +20 -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: 3ee3cf09af1f0d5b0b2379476f041fb77b11359e
|
4
|
+
data.tar.gz: 8d5c8f34faea3644b419f6648a267646436d3bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71fe95c8e28a99f36cbd69987b13e01e23c4f3e7b45e4091cb768459cf1ac073b8a728ca92416921c44ac17495ea9c24f606216d3fa8db105d44d5cb3c4f0238
|
7
|
+
data.tar.gz: cb80c0d4fe13b5a6e216d714e8c62f8fb9c0a2d05a75bf6749f5403fee39f600fde26d4bf14fde2b038dc4f80a1a7ea8e48e97d8b0f417a7520aaace032b8390
|
data/README.md
CHANGED
@@ -46,6 +46,8 @@ date.bank_holiday? # Returns false
|
|
46
46
|
date.weekend? # Returns false
|
47
47
|
date.next_banking_day # Returns Monday, January 6, 2014
|
48
48
|
date.banking_day? # Returns true
|
49
|
+
date.first_banking_day_of_month? # Returns false
|
50
|
+
date.last_banking_day_of_month? # Returns false
|
49
51
|
|
50
52
|
Date.new(2014, 1, 16).add_banking_days(2) # Returns Tuesday, January 21, 2014
|
51
53
|
Date.new(2014, 1, 5).previous_banking_day # Returns Friday, January 3, 2014
|
data/lib/us_bank_holidays.rb
CHANGED
@@ -87,6 +87,16 @@ module UsBankHolidays
|
|
87
87
|
def banking_day?
|
88
88
|
!bank_holiday?
|
89
89
|
end
|
90
|
+
|
91
|
+
# Returns true if the date is the last banking day of the month, false otherwise.
|
92
|
+
def last_banking_day_of_month?
|
93
|
+
!bank_holiday? && next_banking_day.month != month
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns true if the date is the first banking day of the month, false otherwise.
|
97
|
+
def first_banking_day_of_month?
|
98
|
+
!bank_holiday? && previous_banking_day.month != month
|
99
|
+
end
|
90
100
|
end
|
91
101
|
|
92
102
|
end
|
@@ -217,5 +217,25 @@ describe UsBankHolidays do
|
|
217
217
|
Date.new(2014, 1, 21).add_banking_days(-2).should == Date.new(2014, 1, 16)
|
218
218
|
end
|
219
219
|
end
|
220
|
+
|
221
|
+
describe '.last_banking_day_of_month?' do
|
222
|
+
it 'should determine if a date is the last banking day of the month' do
|
223
|
+
Date.new(2014, 1, 31).last_banking_day_of_month?.should be_true
|
224
|
+
Date.new(2014, 1, 30).last_banking_day_of_month?.should be_false
|
225
|
+
|
226
|
+
Date.new(2014, 11, 30).last_banking_day_of_month?.should be_false
|
227
|
+
Date.new(2014, 11, 28).last_banking_day_of_month?.should be_true
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
describe '.first_banking_day_of_month?' do
|
232
|
+
it 'should determine if the date if the first banking day of the month' do
|
233
|
+
Date.new(2014, 4, 1).first_banking_day_of_month?.should be_true
|
234
|
+
Date.new(2014, 4, 2).first_banking_day_of_month?.should be_false
|
235
|
+
|
236
|
+
Date.new(2014, 6, 1).first_banking_day_of_month?.should be_false
|
237
|
+
Date.new(2014, 6, 2).first_banking_day_of_month?.should be_true
|
238
|
+
end
|
239
|
+
end
|
220
240
|
end
|
221
241
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: us_bank_holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Shagall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|