lib/whois/parser.rb in whois-parser-1.2.0 vs lib/whois/parser.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 'whois' require 'active_support/core_ext/array/extract_options' @@ -157,14 +157,14 @@ # # Parser.host_to_parser("whois.nic-info.it") # # => "WhoisNicInfoIt" # def self.host_to_parser(host) - host.to_s.downcase. - gsub(/[.-]/, '_'). - gsub(/(?:^|_)(.)/) { $1.upcase }. - gsub(/\A(\d+)\z/) { "Host#{$1}" } + host.to_s.downcase + .gsub(/[.-]/, '_') + .gsub(/(?:^|_)(.)/) { ::Regexp.last_match(1).upcase } + .gsub(/\A(\d+)\z/) { "Host#{::Regexp.last_match(1)}" } end # Requires the file at <tt>whois/parsers/#{name}</tt>. # # @param [String] name The file name to load. @@ -273,11 +273,11 @@ unless other.is_a?(self.class) raise(ArgumentError, "Can't compare `#{self.class}' with `#{other.class}'") end equal?(other) || - parsers.size == other.parsers.size && all_in_parallel?(parsers, other.parsers) { |one, two| one.unchanged?(two) } + (parsers.size == other.parsers.size && all_in_parallel?(parsers, other.parsers) { |one, two| one.unchanged?(two) }) end # Loop through all the parts to check if at least # one part is an incomplete response. @@ -428,9 +428,10 @@ count = args.first.size index = 0 while index < count return false unless yield(*args.map { |arg| arg[index] }) + index += 1 end true end