distance 0.3.0 → 0.3.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: 5d123ba2ed9a2734083d1cb3d7fd722af9e327f8
4
- data.tar.gz: fbf75d9780f99dc8bcf72ab3f3c76514921cfb80
3
+ metadata.gz: 0458b08c5bfa15588f29a9d14de9514610241e03
4
+ data.tar.gz: cf0704ea44beea40f4f21550f210815b44a22d0d
5
5
  SHA512:
6
- metadata.gz: 1d7f03ddadf2fc1fee516a4fccdfabfa5182b774dc0cb9ea82697297c794ef9c40446015151543064d91d7df4bb7579f5cb9c10e66f72672ebcdb60ee12e8ee9
7
- data.tar.gz: 1fac374e015221e06e6304dc1513058826cf85f7892653288d8f5bf3ef60386c4cb6a1dd556b0609207bdb0381627f55d5cf6e86b9fa466c1b4b638052df260a
6
+ metadata.gz: cb694566926dbc4f0983c51af4af03cafcf94a64847fb17f307376dc928fff0c6d765b26024fda5da8cd0541f51d25e0745ca87a4ca1296a3536a9462960ec2d
7
+ data.tar.gz: 4ff910bf125cfca7643cacbc5e98dedb09ee797588a5b6be71b048212ca7a9601a808de75e23dbbfddcd49d8f4e63434396f9d295b1009bf3e746930b3f3e97a
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.3.7
4
5
  - 2.3.4
5
6
  - 2.4.1
6
7
  before_install: gem install bundler -v 1.14.6
@@ -1,7 +1,36 @@
1
- class Integer
2
- alias_method :orig_multiply, :*
1
+ # Test to see if Fixnum/Bignum are deprecated, which implies we are in ruby 2.4
2
+ # or greater
3
3
 
4
- def *(other)
5
- other.is_a?(Distance) ? other * self : orig_multiply(other)
4
+ # Silence any deprecation warnings
5
+ warn_level = $VERBOSE
6
+ $VERBOSE = nil
7
+ v2_4 = Fixnum == Integer
8
+ $VERBOSE = warn_level
9
+
10
+ if v2_4
11
+ class Integer
12
+ alias_method :orig_multiply, :*
13
+
14
+ def *(other)
15
+ other.is_a?(Distance) ? other * self : orig_multiply(other)
16
+ end
17
+ end
18
+ else
19
+ # In ruby versions before 2.4, multiplication was defined in Bignum and Fixnum,
20
+ # not in Integer
21
+ class Bignum
22
+ alias_method :orig_multiply, :*
23
+
24
+ def *(other)
25
+ other.is_a?(Distance) ? other * self : orig_multiply(other)
26
+ end
27
+ end
28
+
29
+ class Fixnum
30
+ alias_method :orig_multiply, :*
31
+
32
+ def *(other)
33
+ other.is_a?(Distance) ? other * self : orig_multiply(other)
34
+ end
6
35
  end
7
36
  end
@@ -1,3 +1,3 @@
1
1
  class Distance
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Collier