fat_core 4.8.2 → 4.8.3

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
  SHA256:
3
- metadata.gz: 626d8f221d0dc52dd3914d8a5b6a28d92211a90fb9d1851c650203c76f1a1cff
4
- data.tar.gz: 1cee79cbd3a51d530e95a8b52b994bdb430c9bb6a6630041f56564e3436fc5d6
3
+ metadata.gz: 7185e045a281695d2f45f26e53d2614125dc0b8f8912e247008b1bafa2a3e98e
4
+ data.tar.gz: 5ee7ed7308b1a5300f8eb278c00bbdd95ec04adc22c8e46e7743741a0d34df7b
5
5
  SHA512:
6
- metadata.gz: 8809c0b8ba8e2a4909ece3b7f4733e607d6a8c8a205e08f6e30ed9018659a1c8aa26dc177f909408fd54613cbb8563b5d4ed5a0fc5856cabed50b273803f0fcb
7
- data.tar.gz: 207bca7517f91e868b3f246a13d277d5a64bdd9c05a669b67b8f70d735261722f9d0ea6ab51d1a4f9d906696bb45f8015f2f85aa92bf07efd89618238dbde077
6
+ metadata.gz: 2a1519d932d6f7409f1b4ec0e873836f675c9c77c1655ba0884d43fca62ba7209fca32dd6860e60e29ab9147ab8f8dde5cb1279a23ffc1517d73885e2dbd5fa1
7
+ data.tar.gz: c740324e31d150b670cd940ffec4ed4394fe4223b8f951dff8838f176c39905b753d3dce8017f77477cd440ad171e3839d626d8b54e4cf8e00782516114b2850
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  /GTAGS
21
21
  /.rubocop_todo.yml
22
22
  /gtags.files
23
+ /.ruby-version
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  bundler_args: --without debug
3
3
  rvm:
4
- - 2.2.2
5
- - 2.3
6
- - 2.4
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
7
  - ruby-head
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'damerau-levenshtein', git: 'https://github.com/ddoherty03/damerau-levenshtein'
4
+
3
5
  # Specify your gem's dependencies in fat_core.gemspec
4
6
  gemspec
5
7
 
@@ -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
@@ -161,20 +161,25 @@ module FatCore
161
161
  raise 'Range difference requires objects have pred and succ methods'
162
162
  end
163
163
 
164
- if subset_of?(other)
165
- # (4..7) - (0..10)
166
- []
167
- elsif proper_superset_of?(other)
168
- # (4..7) - (5..5) -> [(4..4), (6..7)]
169
- [(min..other.min.pred), (other.max.succ..max)]
170
- elsif overlaps?(other) && other.min <= min
171
- # (4..7) - (2..5) -> (6..7)
172
- [(other.max.succ..max)]
173
- elsif overlaps?(other) && other.max >= max
174
- # (4..7) - (6..10) -> (4..5)
175
- [(min..other.min.pred)]
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
- [self]
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, without their
284
- # boundaries touching.
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
- min > other.min && max < other.max
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, without their
302
- # boundaries touching.
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
- min < other.min && max > other.max
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.
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 4
3
3
  MINOR = 8
4
- PATCH = 2
4
+ PATCH = 3
5
5
 
6
6
  # FatCore version number
7
7
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'fat_core/bigdecimal'
2
3
 
3
4
  describe BigDecimal do
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
- #require 'spec_helper'
3
2
 
3
+ require 'spec_helper'
4
4
  require 'fat_core/date'
5
5
 
6
6
  describe Date do
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
-
3
2
  require 'fat_core/enumerable'
4
3
 
5
4
  describe Enumerable do
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
-
3
2
  require 'fat_core/hash'
4
3
 
5
4
  describe Hash do
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
-
3
2
  require 'fat_core/kernel'
4
3
 
5
4
  describe Kernel do
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
-
3
2
  require 'fat_core/nil'
4
3
 
5
4
  describe NilClass do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'fat_core/numeric'
2
3
 
3
4
  describe Numeric do
@@ -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)).not_to be_proper_superset_of((6..8))
38
- expect((4..8)).not_to be_proper_superset_of((4..7))
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))
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'fat_core/symbol'
2
3
 
3
4
  describe Symbol do
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.2
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-03-18 00:00:00.000000000 Z
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
- rubygems_version: 3.0.3
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