fat_core 4.8.2 → 4.8.3
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/.gitignore +1 -0
- data/.travis.yml +3 -3
- data/Gemfile +2 -0
- data/fat_core.gemspec +0 -2
- data/lib/fat_core/range.rb +26 -19
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/bigdecimal_spec.rb +1 -0
- data/spec/lib/date_spec.rb +1 -1
- data/spec/lib/enumerable_spec.rb +0 -1
- data/spec/lib/hash_spec.rb +0 -1
- data/spec/lib/kernel_spec.rb +0 -1
- data/spec/lib/nil_spec.rb +0 -1
- data/spec/lib/numeric_spec.rb +1 -0
- data/spec/lib/range_spec.rb +4 -2
- data/spec/lib/symbol_spec.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7185e045a281695d2f45f26e53d2614125dc0b8f8912e247008b1bafa2a3e98e
|
4
|
+
data.tar.gz: 5ee7ed7308b1a5300f8eb278c00bbdd95ec04adc22c8e46e7743741a0d34df7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a1519d932d6f7409f1b4ec0e873836f675c9c77c1655ba0884d43fca62ba7209fca32dd6860e60e29ab9147ab8f8dde5cb1279a23ffc1517d73885e2dbd5fa1
|
7
|
+
data.tar.gz: c740324e31d150b670cd940ffec4ed4394fe4223b8f951dff8838f176c39905b753d3dce8017f77477cd440ad171e3839d626d8b54e4cf8e00782516114b2850
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/fat_core.gemspec
CHANGED
@@ -4,8 +4,6 @@ lib = File.expand_path('../lib', __FILE__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'fat_core/version'
|
6
6
|
|
7
|
-
gem 'damerau-levenshtein', git: 'https://github.com/ddoherty03/damerau-levenshtein'
|
8
|
-
|
9
7
|
Gem::Specification.new do |spec|
|
10
8
|
spec.name = 'fat_core'
|
11
9
|
spec.version = FatCore::VERSION
|
data/lib/fat_core/range.rb
CHANGED
@@ -161,20 +161,25 @@ module FatCore
|
|
161
161
|
raise 'Range difference requires objects have pred and succ methods'
|
162
162
|
end
|
163
163
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
164
|
+
# Remove the intersection of self and other from self. The intersection
|
165
|
+
# is either (a) empty, so return self, (b) coincides with self, so
|
166
|
+
# return nothing,
|
167
|
+
isec = self & other
|
168
|
+
return [self] if isec.nil?
|
169
|
+
return [] if isec == self
|
170
|
+
|
171
|
+
# (c) touches self on the right, (d) touches self on the left, or (e)
|
172
|
+
# touches on neither the left or right, in which case the difference is
|
173
|
+
# two ranges.
|
174
|
+
if isec.max == max && isec.min > min
|
175
|
+
# Return the part to the left of isec
|
176
|
+
[(min..isec.min.pred)]
|
177
|
+
elsif isec.min == min && isec.max < max
|
178
|
+
# Return the part to the right of isec
|
179
|
+
[(isec.max.succ..max)]
|
176
180
|
else
|
177
|
-
|
181
|
+
# Return the parts to the left and right of isec
|
182
|
+
[(min..isec.min.pred), (isec.max.succ..max)]
|
178
183
|
end
|
179
184
|
end
|
180
185
|
alias - difference
|
@@ -280,13 +285,14 @@ module FatCore
|
|
280
285
|
min >= other.min && max <= other.max
|
281
286
|
end
|
282
287
|
|
283
|
-
# Return whether self is contained within `other` range,
|
284
|
-
#
|
288
|
+
# Return whether self is contained within `other` range, with at most one
|
289
|
+
# boundary touching.
|
285
290
|
#
|
286
291
|
# @param other [Range] the containing range
|
287
292
|
# @return [Boolean] is self wholly within other
|
288
293
|
def proper_subset_of?(other)
|
289
|
-
|
294
|
+
subset_of?(other) &&
|
295
|
+
(min > other.min || max < other.max)
|
290
296
|
end
|
291
297
|
|
292
298
|
# Return whether self contains `other` range, even if their
|
@@ -298,13 +304,14 @@ module FatCore
|
|
298
304
|
min <= other.min && max >= other.max
|
299
305
|
end
|
300
306
|
|
301
|
-
# Return whether self contains `other` range,
|
302
|
-
#
|
307
|
+
# Return whether self contains `other` range, with at most one
|
308
|
+
# boundary touching.
|
303
309
|
#
|
304
310
|
# @param other [Range] the contained range
|
305
311
|
# @return [Boolean] does self wholly contain other
|
306
312
|
def proper_superset_of?(other)
|
307
|
-
|
313
|
+
superset_of?(other) &&
|
314
|
+
(min < other.min || max > other.max)
|
308
315
|
end
|
309
316
|
|
310
317
|
# Return whether self overlaps with other Range.
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/bigdecimal_spec.rb
CHANGED
data/spec/lib/date_spec.rb
CHANGED
data/spec/lib/enumerable_spec.rb
CHANGED
data/spec/lib/hash_spec.rb
CHANGED
data/spec/lib/kernel_spec.rb
CHANGED
data/spec/lib/nil_spec.rb
CHANGED
data/spec/lib/numeric_spec.rb
CHANGED
data/spec/lib/range_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'fat_core/range'
|
2
3
|
|
3
4
|
describe Range do
|
@@ -12,6 +13,7 @@ describe Range do
|
|
12
13
|
|
13
14
|
it 'should know if it is a proper subset of another range' do
|
14
15
|
expect((4..8)).to be_proper_subset_of((2..9))
|
16
|
+
expect((4..8)).to be_proper_subset_of((4..9))
|
15
17
|
expect((4..8)).not_to be_proper_subset_of((4..8))
|
16
18
|
expect((4..8)).not_to be_proper_subset_of((2..7))
|
17
19
|
expect((4..8)).not_to be_proper_subset_of((5..8))
|
@@ -34,8 +36,8 @@ describe Range do
|
|
34
36
|
|
35
37
|
it 'should know if it is a proper superset of another range' do
|
36
38
|
expect((4..8)).to be_proper_superset_of((5..7))
|
37
|
-
expect((4..8)).
|
38
|
-
expect((4..8)).
|
39
|
+
expect((4..8)).to be_proper_superset_of((6..8))
|
40
|
+
expect((4..8)).to be_proper_superset_of((4..7))
|
39
41
|
expect((4..8)).not_to be_proper_superset_of((4..8))
|
40
42
|
expect((4..8)).not_to be_proper_superset_of((2..9))
|
41
43
|
expect((4..8)).not_to be_proper_superset_of((2..8))
|
data/spec/lib/symbol_spec.rb
CHANGED
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: 4.8.
|
4
|
+
version: 4.8.3
|
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: 2020-
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -233,7 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
- !ruby/object:Gem::Version
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
|
-
|
236
|
+
rubyforge_project:
|
237
|
+
rubygems_version: 2.7.6.2
|
237
238
|
signing_key:
|
238
239
|
specification_version: 4
|
239
240
|
summary: fat_core provides some useful core extensions
|