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 +4 -4
- data/.ruby-version +1 -1
- data/bin/console +14 -0
- data/fat_core.gemspec +1 -0
- data/lib/fat_core/all.rb +14 -0
- data/lib/fat_core/array.rb +29 -22
- data/lib/fat_core/big_decimal.rb +12 -0
- data/lib/fat_core/date.rb +951 -938
- data/lib/fat_core/enumerable.rb +19 -3
- data/lib/fat_core/hash.rb +48 -43
- data/lib/fat_core/kernel.rb +4 -2
- data/lib/fat_core/nil.rb +13 -13
- data/lib/fat_core/numeric.rb +82 -86
- data/lib/fat_core/range.rb +164 -160
- data/lib/fat_core/string.rb +247 -242
- data/lib/fat_core/symbol.rb +17 -11
- data/lib/fat_core/version.rb +2 -2
- data/lib/fat_core.rb +0 -21
- data/spec/lib/array_spec.rb +2 -0
- data/spec/lib/big_decimal_spec.rb +7 -0
- data/spec/lib/date_spec.rb +7 -26
- data/spec/lib/enumerable_spec.rb +26 -1
- data/spec/lib/hash_spec.rb +2 -0
- data/spec/lib/kernel_spec.rb +2 -0
- data/spec/lib/nil_spec.rb +6 -0
- data/spec/lib/numeric_spec.rb +1 -5
- data/spec/lib/range_spec.rb +1 -1
- data/spec/lib/string_spec.rb +1 -6
- data/spec/lib/symbol_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +9 -8
- data/lib/fat_core/boolean.rb +0 -25
- data/lib/fat_core/latex_eruby.rb +0 -11
- data/lib/fat_core/period.rb +0 -533
- data/spec/lib/period_spec.rb +0 -677
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1683ad80cc0beeb11788dc2b0309f61879109de5
|
4
|
+
data.tar.gz: 35f7be2a9a512700ebcc327bff6df8a59ae9b4cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f0d3d2b01f59d9bd931e477226d3a7631005bdf2c8bc6912c0baaeaa8dc3bf0f97be32bd3851992d75e37b0790b57e406007f7ff7fa8f96c233ce8f3cc4bbff
|
7
|
+
data.tar.gz: b243a502b75d8501e86b899b00cebdfb09ae35659615b0611e82284fdd2497d55df952e381208b32efadbd59c082b8962f6750ede8989a245d0bd81ee5efd87f
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
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/ }
|
data/lib/fat_core/all.rb
ADDED
@@ -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'
|
data/lib/fat_core/array.rb
CHANGED
@@ -1,28 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|