fat_core 2.0.1 → 3.0.0

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: da78308a426ec42f9920c3d5ca369c42abbe115b
4
- data.tar.gz: 91924adb3efec242ed5f1a2ad2db9d4c90cc5c27
3
+ metadata.gz: 1683ad80cc0beeb11788dc2b0309f61879109de5
4
+ data.tar.gz: 35f7be2a9a512700ebcc327bff6df8a59ae9b4cf
5
5
  SHA512:
6
- metadata.gz: 6fbef2316f1716b2ee05235d328496143c16d779574a753cb4ffd027da713b72873eb85200c0530695b606b684418d337d18713d02723505f94d9525f7462369
7
- data.tar.gz: 6fa8b41ea91fa61421fc7707e6529cc1b786f408b6d4328338af6f945b6af979c1d4f94848ea3a893c66c05565f5198bed00bfde3572007751322f776b8413c5
6
+ metadata.gz: 8f0d3d2b01f59d9bd931e477226d3a7631005bdf2c8bc6912c0baaeaa8dc3bf0f97be32bd3851992d75e37b0790b57e406007f7ff7fa8f96c233ce8f3cc4bbff
7
+ data.tar.gz: b243a502b75d8501e86b899b00cebdfb09ae35659615b0611e82284fdd2497d55df952e381208b32efadbd59c082b8962f6750ede8989a245d0bd81ee5efd87f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fat_core"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ #require "irb"
14
+ #IRB.start(__FILE__)
data/fat_core.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Write a longer description. Optional.'
13
13
  spec.homepage = ''
14
14
  spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.3.1'
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0")
17
18
  spec.files.reject! { |fn| fn =~ /^NYSE_closings.pdf/ }
@@ -0,0 +1,14 @@
1
+ require 'fat_core/array'
2
+ require 'fat_core/big_decimal'
3
+ require 'fat_core/date'
4
+ require 'fat_core/boolean'
5
+ require 'fat_core/enumerable'
6
+ require 'fat_core/hash'
7
+ require 'fat_core/kernel'
8
+ #require 'fat_core/latex_eruby'
9
+ require 'fat_core/nil'
10
+ require 'fat_core/numeric'
11
+ require 'fat_core/period'
12
+ require 'fat_core/range'
13
+ require 'fat_core/string'
14
+ require 'fat_core/symbol'
@@ -1,28 +1,35 @@
1
- class Array
2
- def last_i
3
- self.size - 1
4
- end
1
+ module FatCore
2
+ module Array
3
+ # Return the index of the last element of this Array. This is just a
4
+ # convenience for an oft-needed Array attribute.
5
+ def last_i
6
+ self.size - 1
7
+ end
5
8
 
6
- # Return a new array that is the intersection of this Array with other, but
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.
10
- def intersect(other)
11
- result = []
12
- each do |itm|
13
- result << itm if other.include?(itm)
9
+ # Return a new Array that is the intersection of this Array with +other+,
10
+ # but without removing duplicates as the Array#& method does. All items of
11
+ # this Array are included in the result but only if they also appear in the
12
+ # +other+ Array.
13
+ def intersect(other)
14
+ result = []
15
+ each do |itm|
16
+ result << itm if other.include?(itm)
17
+ end
18
+ result
14
19
  end
15
- result
16
- end
17
20
 
18
- # Return an array that is the difference between this Array and the other, but
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.
21
- def difference(other)
22
- result = []
23
- each do |itm|
24
- result << itm unless other.include?(itm)
21
+ # Return an Array that is the difference between this Array and +other+, but
22
+ # without removing duplicates as the Array#- method does. All items of this
23
+ # Array are included in the result unless they also appear in the +other+
24
+ # Array.
25
+ def difference(other)
26
+ result = []
27
+ each do |itm|
28
+ result << itm unless other.include?(itm)
29
+ end
30
+ result
25
31
  end
26
- result
27
32
  end
28
33
  end
34
+
35
+ Array.include FatCore::Array
@@ -0,0 +1,12 @@
1
+ require 'bigdecimal'
2
+
3
+ module FatCore
4
+ module BigDecimal
5
+ # Provide a human-readable display for BigDecimal. e.g., while debugging.
6
+ def inspect
7
+ to_f.to_s
8
+ end
9
+ end
10
+ end
11
+
12
+ BigDecimal.prepend(FatCore::BigDecimal)