Sha256: a5cd339f0f0712893a46caa7336f173a7c70ec440c6b76d11acd312145918ceb

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 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.rnids.rs record.
      #
      # @since  2.4.0
      class WhoisRnidsRs < Base

        self.tokenizers += [
            :scan_available,
            :skip_comment,
            :flag_section_start,
            :scan_keyvalue,
            :flag_section_end,
            :skip_empty_line,
            :skip_privacy,
        ]


        SECTIONS = ["Owner", "Administrative contact", "Technical contact"]

        tokenizer :scan_available do
          if @input.scan(/^%ERROR:103: Domain is not registered/)
            @ast["status:available"] = true
          end
        end

        tokenizer :flag_section_start do
          if SECTIONS.any? { |section| @input.check(/^(#{section}):/) }
            @tmp['_section'] = @input[1]
          end
          false
        end

        tokenizer :flag_section_end do
          if @input.match?(/^\n/)
            @tmp.delete('_section')
          end
        end

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

        tokenizer :skip_privacy do
          @input.skip(/^Whois privacy has been activated for domain.\n/)
        end

      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
whois-3.2.0 lib/whois/record/scanners/whois.rnids.rs.rb
whois-3.1.3 lib/whois/record/scanners/whois.rnids.rs.rb
whois-3.1.2 lib/whois/record/scanners/whois.rnids.rs.rb
whois-3.1.1 lib/whois/record/scanners/whois.rnids.rs.rb
whois-3.1.0 lib/whois/record/scanners/whois.rnids.rs.rb
whois-3.0.0 lib/whois/record/scanners/whois.rnids.rs.rb