fat_core 0.2.8 → 0.2.9
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 +4 -4
- data/lib/fat_core/date.rb +3 -0
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/date_spec.rb +8 -0
- 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: 35128d619a5a539a01d9dca576d4320a4b92376f
|
4
|
+
data.tar.gz: a49087393debc6cbe6671ab032c150ff911e80c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd166e12d04182998e3daf894fac4d30f9979b4ce168047a782e279897c51783395a02a81f9044beb10e496be0b1dbcf4e951bfd7fee4ed0f2b38fadaca4d5ed
|
7
|
+
data.tar.gz: 7904ddf24bcb792d71e373e50f9f9be05b82169f1e013da76d04f3586a512ce0bd313dd7d24a7dc72142221e35a5344d47e8d6913e5253048a5f7e1976bd0141
|
data/lib/fat_core/date.rb
CHANGED
@@ -829,6 +829,7 @@ class Date
|
|
829
829
|
def nyse_workday?
|
830
830
|
!nyse_holiday?
|
831
831
|
end
|
832
|
+
alias :trading_day? :nyse_workday?
|
832
833
|
|
833
834
|
def add_fed_business_days(n)
|
834
835
|
d = self.dup
|
@@ -869,8 +870,10 @@ class Date
|
|
869
870
|
def next_nyse_workday
|
870
871
|
add_nyse_business_days(1)
|
871
872
|
end
|
873
|
+
alias :next_trading_day :next_nyse_workday
|
872
874
|
|
873
875
|
def prior_nyse_workday
|
874
876
|
add_nyse_business_days(-1)
|
875
877
|
end
|
878
|
+
alias :prior_trading_day :prior_nyse_workday
|
876
879
|
end
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/date_spec.rb
CHANGED
@@ -789,6 +789,10 @@ describe Date do
|
|
789
789
|
# Weekends are holidays, regardless
|
790
790
|
expect(Date.parse('2014-11-22')).not_to be_nyse_workday
|
791
791
|
expect(Date.parse('2014-11-23')).not_to be_nyse_workday
|
792
|
+
|
793
|
+
# Alias to trading_day?
|
794
|
+
expect(Date.parse('2014-11-22')).not_to be_trading_day
|
795
|
+
expect(Date.parse('2014-11-23')).not_to be_trading_day
|
792
796
|
end
|
793
797
|
|
794
798
|
it "should know the next federal workday" do
|
@@ -816,6 +820,8 @@ describe Date do
|
|
816
820
|
.to eq Date.parse('2016-04-21')
|
817
821
|
expect(Date.parse('2016-04-22').next_nyse_workday)
|
818
822
|
.to eq Date.parse('2016-04-25')
|
823
|
+
expect(Date.parse('2016-04-22').next_trading_day)
|
824
|
+
.to eq Date.parse('2016-04-25')
|
819
825
|
end
|
820
826
|
|
821
827
|
it "should know the prior NYSE workday" do
|
@@ -829,6 +835,8 @@ describe Date do
|
|
829
835
|
.to eq Date.parse('2016-04-20')
|
830
836
|
expect(Date.parse('2016-04-25').prior_nyse_workday)
|
831
837
|
.to eq Date.parse('2016-04-22')
|
838
|
+
expect(Date.parse('2016-04-25').prior_trading_day)
|
839
|
+
.to eq Date.parse('2016-04-22')
|
832
840
|
end
|
833
841
|
end
|
834
842
|
end
|