Skip to content

Commit 8ffd955

Browse files
github-728: improve code styling
1 parent 99597a7 commit 8ffd955

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/rollbar/util/ip_anonymizer.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,17 @@ module IPAnonymizer
55

66
def self.anonymize_ip(ip_string)
77
return ip_string unless Rollbar.configuration.anonymize_user_ip
8-
98
ip = IPAddr.new(ip_string)
10-
11-
if ip.ipv6?
12-
return anonymize_ipv6 ip
13-
end
14-
15-
if ip.ipv4?
16-
return anonymize_ipv4 ip
17-
end
18-
9+
return anonymize_ipv6 ip if ip.ipv6?
10+
return anonymize_ipv4 ip if ip.ipv4?
1911
rescue
2012
nil
2113
end
2214

2315
def self.anonymize_ipv4(ip)
2416
ip_parts = ip.to_s.split '.'
2517

26-
ip_parts[ip_parts.count-1] = "0"
18+
ip_parts[ip_parts.count - 1] = '0'
2719

2820
IPAddr.new(ip_parts.join('.')).to_s
2921
end

0 commit comments

Comments
 (0)