us_bank_holidays 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b60841173b3f8f7871352347c1182b85a23dc144
4
- data.tar.gz: 0aaa072931196f5f0f6a342efb0f4ae831280097
3
+ metadata.gz: 3ee3cf09af1f0d5b0b2379476f041fb77b11359e
4
+ data.tar.gz: 8d5c8f34faea3644b419f6648a267646436d3bfc
5
5
  SHA512:
6
- metadata.gz: 4a523666e1a6f5b81383b8592c13de633e55a8101bbfc8e2fae9daa2acd651e172d2b45f6fa9897169394b6faed24de7ad3be0cea54118bbada2be319176a08f
7
- data.tar.gz: c075e3c186c6420301a838125a6ba02cd993ac412ba269155ea42341450d6f00ca9f7d2d2fe68b5b8b6f457290f8c5ce5f097c9bbdb1c60fb0bf80961bf77e36
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module UsBankHolidays
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  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.5
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-02-24 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler