Sha256: b9ed1057fa8cf80ece61fae93031f1fab978d3b4501936a9ca09f77bff0c35df

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
#++


require_relative 'base_cocca'


module Whois
  class Parsers

    # Parser for the whois.nic.as server.
    #
    # @see Whois::Parsers::Example
    #   The Example parser for the list of all available methods.
    #
    class WhoisNicAs < Base

      property_supported :status do
        if available?
          :available
        else
          :registered
        end
      end

      property_supported :available? do
        !!(content_for_scanner =~ /NOT FOUND/)
      end

      property_supported :registered? do
        !available?
      end


      property_supported :created_on do
        nil # TODO
      end

      property_not_supported :updated_on

      property_supported :expires_on do
        nil # TODO
      end


      property_supported :nameservers do
        if content_for_scanner =~ /Name servers:\n((.+\n)+)\n/
          $1.strip.split("\n").map do |line|
            name, ipv4, ipv6 = line.strip.split(/\s+/)
            Parser::Nameserver.new(name: name, ipv4: ipv4, ipv6: ipv6)
          end
        end
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whois-parser-1.2.0 lib/whois/parsers/whois.nic.as.rb
whois-parser-1.1.0 lib/whois/parsers/whois.nic.as.rb