We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99597a7 commit 8ffd955Copy full SHA for 8ffd955
lib/rollbar/util/ip_anonymizer.rb
@@ -5,25 +5,17 @@ module IPAnonymizer
5
6
def self.anonymize_ip(ip_string)
7
return ip_string unless Rollbar.configuration.anonymize_user_ip
8
-
9
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
18
+ return anonymize_ipv6 ip if ip.ipv6?
+ return anonymize_ipv4 ip if ip.ipv4?
19
rescue
20
nil
21
end
22
23
def self.anonymize_ipv4(ip)
24
ip_parts = ip.to_s.split '.'
25
26
- ip_parts[ip_parts.count-1] = "0"
+ ip_parts[ip_parts.count - 1] = '0'
27
28
IPAddr.new(ip_parts.join('.')).to_s
29
0 commit comments