lib/whois/parsers/whois.nic.uk.rb in whois-parser-1.2.0 vs lib/whois/parsers/whois.nic.uk.rb in whois-parser-2.0.0
- old
+ new
@@ -1,11 +1,11 @@
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
-# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
+# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
#++
require_relative 'base'
@@ -28,11 +28,11 @@
# @see http://www.nominet.org.uk/registrars/systems/data/regstatus/
# @see http://www.nominet.org.uk/registrants/maintain/renew/status/
#
property_supported :status do
if content_for_scanner =~ /\s+Registration status:\s+(.+?)\n/
- case $1.downcase
+ case ::Regexp.last_match(1).downcase
when "registered until expiry date."
:registered
when "registration request being processed."
:registered
when "renewal request being processed."
@@ -43,11 +43,11 @@
:reserved
# NEWSTATUS redemption (https://github.com/weppos/whois/issues/5)
when "renewal required."
:registered
else
- Whois::Parser.bug!(ParserError, "Unknown status `#{$1}'.")
+ Whois::Parser.bug!(ParserError, "Unknown status `#{::Regexp.last_match(1)}'.")
end
elsif invalid?
:invalid
else
:available
@@ -63,37 +63,37 @@
end
property_supported :created_on do
if content_for_scanner =~ /\s+Registered on:\s+(.+)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
property_supported :updated_on do
if content_for_scanner =~ /\s+Last updated:\s+(.+)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
property_supported :expires_on do
if content_for_scanner =~ /\s+Expiry date:\s+(.+)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
# @see http://www.nic.uk/other/whois/instruct/
property_supported :registrar do
if content_for_scanner =~ /Registrar:\n((.+\n)+)\n/
- content = $1.strip
+ content = ::Regexp.last_match(1).strip
id = name = org = url = nil
if content =~ /Tag =/
- name, id = (content =~ /(.+) \[Tag = (.+)\]/) && [$1.strip, $2.strip]
+ name, id = (content =~ /(.+) \[Tag = (.+)\]/) && [::Regexp.last_match(1).strip, ::Regexp.last_match(2).strip]
org, name = name.split(" t/a ")
- url = (content =~ /URL: (.+)/) && $1.strip
+ url = (content =~ /URL: (.+)/) && ::Regexp.last_match(1).strip
elsif content =~ /This domain is registered directly with Nominet/
name = "Nominet"
org = "Nominet UK"
url = "http://www.nic.uk/"
end
@@ -108,11 +108,11 @@
end
property_supported :registrant_contacts do
if content_for_scanner =~ /Registrant's address:\n((.+\n)+)\n/
- lines = $1.split("\n").map(&:strip)
+ lines = ::Regexp.last_match(1).split("\n").map(&:strip)
address = lines[0..-5]
city = lines[-4]
state = lines[-3]
zip = lines[-2]
country = lines[-1]
@@ -130,10 +130,10 @@
end
property_supported :nameservers do
if content_for_scanner =~ /Name servers:\n((.+\n)+)\n/
- $1.split("\n").reject { |value| value =~ /No name servers listed/ }.map do |line|
+ ::Regexp.last_match(1).split("\n").reject { |value| value =~ /No name servers listed/ }.map do |line|
name, ipv4, ipv6 = line.strip.split(/\s+/)
Parser::Nameserver.new(:name => name, :ipv4 => ipv4, :ipv6 => ipv6)
end
end
end