Skip to content

Commit

Permalink
Fix rubocop offences
Browse files Browse the repository at this point in the history
  • Loading branch information
jbilbo committed Oct 16, 2024
1 parent 87cffd6 commit e76cf94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/ip_ranger/ip_address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

module IPRanger
class IPAddress < DelegateClass(IPAddr)
def self.from_integer(i, family, mask = nil)
address = IPAddr.new(i, family)
def self.from_integer(ipnum, family, mask = nil)
address = IPAddr.new(ipnum, family)
address = address.mask(mask) if mask

new(address)
Expand Down Expand Up @@ -41,7 +41,7 @@ def last
private

def mask_addr
__getobj__.instance_variable_get('@mask_addr')
__getobj__.instance_variable_get(:@mask_addr)
end
end
end
4 changes: 2 additions & 2 deletions lib/ip_ranger/ip_range.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def cidr_partition(target, exclude)

target_first = target.first
i_lower = target_first
i_upper = target_first + (2 ** (target_width - new_prefixlen))
i_upper = target_first + (2**(target_width - new_prefixlen))

while exclude.prefixlen >= new_prefixlen
if exclude.first >= i_upper
Expand All @@ -84,7 +84,7 @@ def cidr_partition(target, exclude)
break if new_prefixlen > target_width

i_lower = matched
i_upper = matched + (2 ** (target_width - new_prefixlen))
i_upper = matched + (2**(target_width - new_prefixlen))
end

[left, [exclude], right.reverse]
Expand Down
4 changes: 2 additions & 2 deletions spec/ip_ranger/ip_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
end

it 'raises if given incompatible IP addresses' do
expect { described_class.new('192.168.1.1', '2001:0db8:0000:0042:0000:8a2e:0370:7334') }.
to raise_error('IP sequence cannot contain both IPv4 and IPv6!')
expect { described_class.new('192.168.1.1', '2001:0db8:0000:0042:0000:8a2e:0370:7334') }
.to raise_error('IP sequence cannot contain both IPv4 and IPv6!')
end
end

0 comments on commit e76cf94

Please sign in to comment.