Sha256: f238c2037b0053776b008c5cf10d3757a009b5d44d64651a93de070e69fdc494

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 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

      class WhoisNicSeSe < Base

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


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

        tokenizer :scan_disclaimer do
          if @input.match?(/# Copyright \(c\) [\d-]* \.SE \(The Internet Infrastructure Foundation\)\.\n# All rights reserved\.\n\n/)
            lines = []
            while !@input.match?(/# Result of search for registered domain names under\n/) && @input.scan(/#?(.*)\n/)
              lines << @input[1].strip unless @input[1].strip == ""
            end
            @input.skip_until(/# printed with .+ bits\.\n/m)
            @ast["field:disclaimer"] = lines.join(" ")
          end
        end

      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whois-3.3.1 lib/whois/record/scanners/whois.nic-se.se.rb
whois-3.3.0 lib/whois/record/scanners/whois.nic-se.se.rb