Sha256: 11ce345fff424bf012baaec08ae6b23ef61801b4e9639c9af5fad0f755b56a45

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2013 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.match?(/^no matching record/)
            @ast["status:available"] = true
            @input.scan_until(/\n/)
          end
        end

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

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

      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
whois-3.4.3 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.4.2 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.4.1 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.4.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.3.1 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.3.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.2.1 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.2.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.1.3 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.1.2 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.1.1 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.1.0 lib/whois/record/scanners/whois.cnnic.cn.rb
whois-3.0.0 lib/whois/record/scanners/whois.cnnic.cn.rb