Sha256: 2787e047b975d10dc51eda600ca3bc95e2a9af4853c1c8ae2d4fb394a224ef81

Contents?: true

Size: 1.25 KB

Versions: 7

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/scanners/base'


module Whois
  class Record
    module Scanners

      # Scanner for the Afilias record.
      class Afilias < Base

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


        tokenizer :scan_available do
          if @input.scan(/^NOT FOUND\n/)
            @ast["status:available"] = true
          end
        end

        # .XXX
        tokenizer :scan_reserved do
          if @input.scan(/^Reserved by ICM Registry\n/)
            @ast["status:reserved"] = true
          end
        end

        # .ORG
        tokenizer :scan_throttled do
          if @input.match?(/^WHOIS LIMIT EXCEEDED/)
            @ast["response:throttled"] = true
            @input.skip(/^.+\n/)
          end
        end

        tokenizer :scan_disclaimer do
          if @input.pos == 0 && @input.match?(/^(.+\n){3,}\n/)
            @ast["field:disclaimer"] = _scan_lines_to_array(/^(.+)\n/).join(" ")
          end
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
whois-2.6.4 lib/whois/record/scanners/afilias.rb
whois-2.6.3 lib/whois/record/scanners/afilias.rb
whois-2.6.2 lib/whois/record/scanners/afilias.rb
whois-2.6.1 lib/whois/record/scanners/afilias.rb
whois-2.6.0 lib/whois/record/scanners/afilias.rb
whois-2.5.1 lib/whois/record/scanners/afilias.rb
whois-2.5.0 lib/whois/record/scanners/afilias.rb