Sha256: c1591bc12f97bd2f788c5827937b3cfaf7809b70b0ee8e57003dd050aafe7d07

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

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

      class BaseCocca2 < Base

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


        DISCLAIMER_MATCHES = [
          "TERMS OF USE:", # global
          "Terminos de Uso:", # whois.nic.hn
          "The data in the WHOIS database of Meridian", # whois.meridiantld.net
          "This information is provided", # whois.gg
        ]

        tokenizer :scan_disclaimer do
          if @input.match?(/^#{DISCLAIMER_MATCHES.join("|")}/)
            @ast["field:disclaimer"] = @input.scan_until(/>>>/) ||
                                       # special handler for whois.nic.cx exception
                                       @input.scan_until(/\Z/)
          end
        end

        tokenizer :skip_lastupdate do
          @input.skip(/>>>(.+?)<<<\n/)
        end

        tokenizer :skip_token_additionalsection do
          @input.skip(/Additional Section\n/)
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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