lib/whois/parsers/whois.educause.edu.rb in whois-parser-1.2.0 vs lib/whois/parsers/whois.educause.edu.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'
@@ -23,20 +23,20 @@
#
class WhoisEducauseEdu < Base
property_supported :disclaimer do
if content_for_scanner =~ /\A((.*\n)+)\n--------------------------\n/
- $1
+ ::Regexp.last_match(1)
else
Whois::Parser.bug!(ParserError, "Unable to parse disclaimer.")
end
end
property_supported :domain do
if content_for_scanner =~ /Domain Name:\s(.+?)\n/
- $1.downcase
+ ::Regexp.last_match(1).downcase
end
end
property_not_supported :domain_id
@@ -58,23 +58,23 @@
end
property_supported :created_on do
if content_for_scanner =~ /Domain record activated:\s+(.+?)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
property_supported :updated_on do
if content_for_scanner =~ /Domain record last updated:\s+(.+?)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
property_supported :expires_on do
if content_for_scanner =~ /Domain expires:\s+(.+?)\n/
- parse_time($1)
+ parse_time(::Regexp.last_match(1))
end
end
property_not_supported :registrar
@@ -92,19 +92,19 @@
end
property_supported :nameservers do
if content_for_scanner =~ /Name Servers: \n((.+\n)+)\n/
- $1.split("\n").map do |line|
+ ::Regexp.last_match(1).split("\n").map do |line|
name, ipv4 = line.strip.split(/\s+/)
Parser::Nameserver.new(:name => name.downcase, :ipv4 => ipv4)
end
end
end
- private
+ private
# [NAME] | EMPTY
# [ROLE]?
# [ORGANIZATION]
# [ADDRESS]*
@@ -112,11 +112,11 @@
# [COUNTRY]
# [PHONE]
# [EMAIL]
def build_contact(element, type)
if content_for_scanner =~ /#{element}:\n+((.+\n)+)\n/
- lines = $1.split("\n").map(&:strip)
+ lines = ::Regexp.last_match(1).split("\n").map(&:strip)
items = lines.dup
# Extract variables
# items.shift if items[0].strip == ''
@@ -127,17 +127,15 @@
v9 = items.delete_at(-1)
v6 = items.delete_at(-1)
if v6 =~ /([^\n,]+),\s([A-Z]{2})(?:\s(\d{5}(?:-\d{4})?))/
- v6, v7, v8 = $1, $2, $3
+ v6, v7, v8 = ::Regexp.last_match(1), ::Regexp.last_match(2), ::Regexp.last_match(3)
end
v4 = []
- until items[0] =~ /^\d+/ || items.empty?
- v4 << items.shift
- end
+ v4 << items.shift until items[0] =~ /^\d+/ || items.empty?
v4 = v4.join("\n")
v5 = items.empty? ? nil : items.join("\n")
# Create Contact
@@ -161,21 +159,21 @@
# [ADDRESS]*
# [CITY, ST ZIP] | [CITY]
# [COUNTRY]
def build_contact_registrant(element, type)
if content_for_scanner =~ /#{element}:\n((.+\n)+)\n/
- lines = $1.split("\n").map(&:strip)
+ lines = ::Regexp.last_match(1).split("\n").map(&:strip)
items = lines.dup
# Extract variables
v9 = items.delete_at(-1)
v4 = items.delete_at(0)
v6 = items.delete_at(-1)
if v6 =~ /([^\n,]+),\s([A-Z]{2})(?:\s(\d{5}))/
- v6, v7, v8 = $1, $2, $3
+ v6, v7, v8 = ::Regexp.last_match(1), ::Regexp.last_match(2), ::Regexp.last_match(3)
end
v5 = items.empty? ? nil : items.join("\n")
# Create Contact