fixed codeclimate errors

This commit is contained in:
dinsmol 2021-09-09 13:06:51 +03:00
parent f4e0084895
commit e7e3278267
44 changed files with 118 additions and 150 deletions

View file

@ -54,12 +54,8 @@ class WhiteIp < ApplicationRecord
def ids_including(ip)
ipv4 = ipv6 = []
if check_ip4(ip).present?
ipv4 = select { |white_ip| check_ip4(white_ip.ipv4) === check_ip4(ip) }
end
if check_ip6(ip).present?
ipv6 = select { |white_ip| check_ip6(white_ip.ipv6) === check_ip6(ip) }
end
ipv4 = select { |white_ip| check_ip4(white_ip.ipv4) === check_ip4(ip) } if check_ip4(ip).present?
ipv6 = select { |white_ip| check_ip6(white_ip.ipv6) === check_ip6(ip) } if check_ip6(ip).present?
(ipv4 + ipv6).pluck(:id).flatten.uniq
end
# rubocop:enable Style/CaseEquality