Sha256: 3edddcbd4e3f583b8a23144c76a443301fa1a1075e2952b3aa232387e9950e54

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

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


require 'whois/record/parser/base_cocca'


module Whois
  class Record
    class Parser

      # Parser for the whois.nic.net.nf server.
      class WhoisNicNetNf < BaseCocca

        property_supported :status do
          if content_for_scanner =~ /Status:\s+(.+?)\n/
            case s = $1.downcase
            when "active"         then :registered
            when "delegated"      then :registered
            when "not registered" then :available
            when /pending delete/ then :redemption
            when /pending purge/  then :redemption
            when /not have any records for that zone/ then :invalid
            else
              Whois.bug!(ParserError, "Unknown status `#{s}'.")
            end
          else
            Whois.bug!(ParserError, "Unable to parse status.")
          end
        end


        # NEWPROPERTY
        def valid?
          cached_properties_fetch(:valid?) do
            !invalid?
          end
        end

        # NEWPROPERTY
        def invalid?
          cached_properties_fetch(:invalid?) do
            status == :invalid
          end
        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
whois-2.6.4 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.6.3 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.6.2 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.6.1 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.6.0 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.5.1 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.5.0 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.4.0 lib/whois/record/parser/whois.nic.net.nf.rb
whois-2.3.0 lib/whois/record/parser/whois.nic.net.nf.rb