Sha256: 4464386bbafc8d9965f55e33cb5978a786d92a37c80acc6ccf16a67b27e0c86d

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

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


require 'whois/record/scanners/base'


module Whois
  class Record
    module Scanners

      # Scanner for the Afilias-based records.
      class BaseAfilias < 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 settings[:pattern_disclaimer]
            if @input.match?(settings[:pattern_disclaimer])
              @ast["field:disclaimer"] = _scan_lines_to_array(/^(.+)\n/).join(" ")
            end
          elsif @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

6 entries across 6 versions & 1 rubygems

Version Path
whois-3.5.4 lib/whois/record/scanners/base_afilias.rb
whois-3.5.3 lib/whois/record/scanners/base_afilias.rb
whois-3.5.2 lib/whois/record/scanners/base_afilias.rb
whois-3.5.1 lib/whois/record/scanners/base_afilias.rb
whois-3.5.0 lib/whois/record/scanners/base_afilias.rb
whois-3.4.5 lib/whois/record/scanners/base_afilias.rb