Sha256: 5574aa69e1b39d96f02155b40cd6d604b2856efa4ab6863685ee830325197121

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

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


require 'whois/record/scanners/base'


module Whois
  class Record
    module Scanners

      # Scanner for the whois.cnnic.cn record.
      class WhoisCnnicCn < Base

        self.tokenizers += [
            :skip_empty_line,
            :scan_reserved,
            :scan_reserved_list,
            :scan_available,
            :scan_keyvalue,
        ]


        tokenizer :scan_available do
          if @input.scan(/^no matching record/)
            @ast["status:available"] = true
          end
        end

        tokenizer :scan_reserved do
          if @input.scan(/^the domain you want to register is reserved/)
            @ast["status:reserved"] = true
          end
        end

        tokenizer :scan_reserved_list do
          if @input.scan(/^Sorry, The domain you requested is in the reserved list/)
            @ast["status:reserved"] = true
          end
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
whois-2.7.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.6.4 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.6.3 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.6.2 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.6.1 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.6.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-2.5.1 lib/whois/record/scanners/whois.cnnic.cn.rb