Skip to content
Snippets Groups Projects
Commit 032e8247 authored by Francis Luong (Franco)'s avatar Francis Luong (Franco) Committed by GitHub
Browse files

Merge pull request #86 from koic/integer_unification

Integer Unification for Ruby 2.4.0+
parents 580edc4a fd5b2e0e
No related branches found
No related tags found
No related merge requests found
...@@ -55,10 +55,10 @@ module IPAddress ...@@ -55,10 +55,10 @@ module IPAddress
# #
# Sums two prefixes or a prefix to a # Sums two prefixes or a prefix to a
# number, returns a Fixnum # number, returns a Integer
# #
def +(oth) def +(oth)
if oth.is_a? Fixnum if oth.is_a? Integer
self.prefix + oth self.prefix + oth
else else
self.prefix + oth.prefix self.prefix + oth.prefix
...@@ -68,10 +68,10 @@ module IPAddress ...@@ -68,10 +68,10 @@ module IPAddress
# #
# Returns the difference between two # Returns the difference between two
# prefixes, or a prefix and a number, # prefixes, or a prefix and a number,
# as a Fixnum # as a Integer
# #
def -(oth) def -(oth)
if oth.is_a? Fixnum if oth.is_a? Integer
self.prefix - oth self.prefix - oth
else else
(self.prefix - oth.prefix).abs (self.prefix - oth.prefix).abs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment