Sha256: 942a0ff43afd77b1d36689ee13f45ab630f09471c122bc536639a9cc7f8842b6

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 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 Icann Compliant-based records.
      class BaseIcannCompliant < Base

        self.tokenizers += [
            :skip_head,
            :scan_available,
            :scan_throttled,
            :skip_empty_line,
            :skip_blank_line,
            :scan_keyvalue,
            :skip_end,
        ]

        tokenizer :scan_available do
          if settings[:pattern_available] && @input.skip_until(settings[:pattern_available])
            @ast['status:available'] = true
          end
        end

        tokenizer :scan_throttled do
          if settings[:pattern_throttled] && @input.skip_until(settings[:pattern_throttled])
            @ast['response:throttled'] = true
          end
        end

        tokenizer :skip_head do
          if @input.skip_until(/Domain Name:/)
            @input.scan(/\s?(.+)\n/)
            @ast["Domain Name"] = @input[1].strip
          end
        end

        tokenizer :skip_end do
          @input.terminate
        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
whois-3.6.2 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.6.1 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.6.0 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.9 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.8 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.7 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.6 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.5 lib/whois/record/scanners/base_icann_compliant.rb
whois-3.5.4 lib/whois/record/scanners/base_icann_compliant.rb