fat_core 2.0.0 → 2.0.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
  SHA1:
3
- metadata.gz: 8c3d2ea26248f15906e7885b3efeaa09ffa10554
4
- data.tar.gz: 0d14aa12596198d1add2e0ae2922a89411da65fe
3
+ metadata.gz: da78308a426ec42f9920c3d5ca369c42abbe115b
4
+ data.tar.gz: 91924adb3efec242ed5f1a2ad2db9d4c90cc5c27
5
5
  SHA512:
6
- metadata.gz: 9a68397f420d5a775818d7071e12e4bf15aadbe05f77e8fe1a34066bab5c3ab853040be1399d5bd08be587a33bade93cd7bbade821806a18df5f6f5c4508bb12
7
- data.tar.gz: e1e0c5b69ba7d652c17cf41a788c2d5291c725e9c5fb80cbef1b2edd016146ab67bd4f68b767828bea4d5c5ce9779a47b01bfd6a0299cd3480b9d6bd5ff628c1
6
+ metadata.gz: 6fbef2316f1716b2ee05235d328496143c16d779574a753cb4ffd027da713b72873eb85200c0530695b606b684418d337d18713d02723505f94d9525f7462369
7
+ data.tar.gz: 6fa8b41ea91fa61421fc7707e6529cc1b786f408b6d4328338af6f945b6af979c1d4f94848ea3a893c66c05565f5198bed00bfde3572007751322f776b8413c5
@@ -4,7 +4,9 @@ class Array
4
4
  end
5
5
 
6
6
  # Return a new array that is the intersection of this Array with other, but
7
- # without removing duplicates as the :& method does.
7
+ # without removing duplicates as the :& method does. All items of the first
8
+ # array are included in the result but only if they also appear in the other
9
+ # array.
8
10
  def intersect(other)
9
11
  result = []
10
12
  each do |itm|
@@ -14,13 +16,12 @@ class Array
14
16
  end
15
17
 
16
18
  # Return an array that is the difference between this Array and the other, but
17
- # without removing duplicates as the :- method does.
19
+ # without removing duplicates as the :- method does. All items of the first
20
+ # array are included in the result unless they also appear in the other array.
18
21
  def difference(other)
19
- result = deep_dup
20
- other.each do |itm|
21
- if (k = result.index(itm))
22
- result.delete_at(k)
23
- end
22
+ result = []
23
+ each do |itm|
24
+ result << itm unless other.include?(itm)
24
25
  end
25
26
  result
26
27
  end
data/lib/fat_core/date.rb CHANGED
@@ -869,7 +869,7 @@ class Date
869
869
  # They NYSE has closed on several occasions outside its normal holiday
870
870
  # rules. This detects those dates beginning in 1960. Closing for part of a
871
871
  # day is not counted. See http://www1.nyse.com/pdfs/closings.pdf
872
- def nyse_special_holiday
872
+ def nyse_special_holiday?
873
873
  return false unless self > Date.parse('1960-01-01')
874
874
  case self
875
875
  when Date.parse('1961-05-29')
@@ -942,7 +942,7 @@ class Date
942
942
  # Is self a fixed holiday
943
943
  return true if nyse_fixed_holiday? || nyse_moveable_feast?
944
944
 
945
- return true if nyse_special_holiday
945
+ return true if nyse_special_holiday?
946
946
 
947
947
  if friday? && (self >= Date.parse('1959-07-03'))
948
948
  # A Friday is a holiday if a holiday would fall on the following
@@ -1018,7 +1018,7 @@ class Date
1018
1018
  # Return self if its a trading day, otherwise skip back to the first prior
1019
1019
  # trading day.
1020
1020
  def prior_until_trading_day
1021
- date = self
1021
+ date = dup
1022
1022
  date -= 1 until date.trading_day?
1023
1023
  date
1024
1024
  end
@@ -1026,7 +1026,7 @@ class Date
1026
1026
  # Return self if its a trading day, otherwise skip forward to the first
1027
1027
  # later trading day.
1028
1028
  def next_until_trading_day
1029
- date = self
1029
+ date = dup
1030
1030
  date += 1 until date.trading_day?
1031
1031
  date
1032
1032
  end
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 2
3
3
  MINOR = 0
4
- PATCH = 0
4
+ PATCH = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
@@ -15,10 +15,10 @@ describe Array do
15
15
  end
16
16
 
17
17
  it 'difference' do
18
- expect(%w(A A B A C A B).difference(%w(A B A))).to eq(%w(A C A B))
19
- expect(%w(A A B A C A B).difference(%w(A B))).to eq(%w(A A C A B))
20
- expect(%w(A A B A C A B).difference(%w(A))).to eq(%w(A B A C A B))
21
- expect(%w(A A B A C A B).difference(%w(B))).to eq(%w(A A A C A B))
18
+ expect(%w(A A B A C A B).difference(%w(A B A))).to eq(%w(C))
19
+ expect(%w(A A B A C A B).difference(%w(A B))).to eq(%w(C))
20
+ expect(%w(A A B A C A B).difference(%w(A))).to eq(%w(B C B))
21
+ expect(%w(A A B A C A B).difference(%w(B))).to eq(%w(A A A C A))
22
22
  expect(%w(A A B A C A B).difference(%w(C))).to eq(%w(A A B A A B))
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-08 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov