distance 0.3.0 → 0.3.1
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/.travis.yml +1 -0
- data/lib/distance/core_ext/integer.rb +33 -4
- data/lib/distance/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0458b08c5bfa15588f29a9d14de9514610241e03
|
4
|
+
data.tar.gz: cf0704ea44beea40f4f21550f210815b44a22d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb694566926dbc4f0983c51af4af03cafcf94a64847fb17f307376dc928fff0c6d765b26024fda5da8cd0541f51d25e0745ca87a4ca1296a3536a9462960ec2d
|
7
|
+
data.tar.gz: 4ff910bf125cfca7643cacbc5e98dedb09ee797588a5b6be71b048212ca7a9601a808de75e23dbbfddcd49d8f4e63434396f9d295b1009bf3e746930b3f3e97a
|
data/.travis.yml
CHANGED
@@ -1,7 +1,36 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Test to see if Fixnum/Bignum are deprecated, which implies we are in ruby 2.4
|
2
|
+
# or greater
|
3
3
|
|
4
|
-
|
5
|
-
|
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
|
data/lib/distance/version.rb
CHANGED