Sha256: 80af7ee679a77726a243d03638b092f61d4237cf65644f831d15cd53fe07d747

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 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.nic.dm record.
      #
      # @since  RELEASE
      class WhoisNicDm < Base

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


        tokenizer :skip_comment do
          @input.skip(/^;.*\n/)
        end

        tokenizer :scan_available do
          if @input.skip(/^not found.+\n/)
            @ast["status:available"] = true
          end
        end

        tokenizer :scan_disclaimer do
          if @input.pos == 0 && @input.match?(/^;.*/)
            @ast["field:disclaimer"] = _scan_lines_to_array(/^;(.*)\n/).join(" ")
            @ast["field:disclaimer"].gsub!("  ", "\n")
          end
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whois-3.1.2 lib/whois/record/scanners/whois.nic.dm.rb
whois-3.1.1 lib/whois/record/scanners/whois.nic.dm.rb
whois-3.1.0 lib/whois/record/scanners/whois.nic.dm.rb
whois-3.0.0 lib/whois/record/scanners/whois.nic.dm.rb