Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer Unification for Ruby 2.4.0+ #86

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/ipaddress/prefix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def <=>(oth)

#
# Sums two prefixes or a prefix to a
# number, returns a Fixnum
# number, returns a Integer
#
def +(oth)
if oth.is_a? Fixnum
if oth.is_a? Integer
self.prefix + oth
else
self.prefix + oth.prefix
Expand All @@ -68,10 +68,10 @@ def +(oth)
#
# Returns the difference between two
# prefixes, or a prefix and a number,
# as a Fixnum
# as a Integer
#
def -(oth)
if oth.is_a? Fixnum
if oth.is_a? Integer
self.prefix - oth
else
(self.prefix - oth.prefix).abs
Expand Down