Sha256: bb4598e437ac2fee43739b71154aabff6fdcb63f83ea1651dda3e09a3d498c6d

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 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.gandi.net record.
      class WhoisGandiNet < Base

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

        tokenizer :scan_yaml_header do
          # skip the YAML prelude
          @input.scan(/^---.*\n/)
        end

        tokenizer :scan_available do
          if @input.skip(/^# Not found/)
            @ast["status:available"] = true
          end
        end

        tokenizer :scan_disclaimer do
          if @input.match?(/^#.*/)
            @ast["field:disclaimer"] = _scan_lines_to_array(/^#(.*)\n/).join(" ")
            @ast["field:disclaimer"].gsub!("  ", "\n").gsub!(/\n\d{4}-\d{2}-\d{2}.*CEST/,'')
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-3.3.1 lib/whois/record/scanners/whois.gandi.net.rb