summaryrefslogtreecommitdiff
path: root/app/models/intruder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/intruder.rb')
-rw-r--r--app/models/intruder.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
index db14bf8..249fffc 100644
--- a/app/models/intruder.rb
+++ b/app/models/intruder.rb
@@ -17,11 +17,14 @@ class Intruder < ActiveRecord::Base
before_validation :set_key_if_empty
+ def to_s
+ key
+ end
- def whois
- if ! self.contact_ip.blank?
+ def whois(ip_address = self.contact_ip)
+ if ! ip_address.blank?
begin
- return Whois.whois(self.contact_ip)
+ return Whois.whois(ip_address).to_s.gsub(/[^\u{0000}-\u{007F}]/, '')
rescue
return nil
end