Sha256: f78cc785edb963df50a4993e4405ba2806c271cbd33b8ae477eab9ed3ee8f49d
Contents?: true
Size: 1.43 KB
Versions: 8
Compression:
Stored size: 1.43 KB
Contents
#-- # Ruby Whois # # An intelligent pure Ruby WHOIS client and parser. # # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net> #++ require 'whois/record/parser/scanners/base' module Whois class Record class Parser module Scanners class Whoisbiz < Scanners::Base def parse_content parse_available || parse_keyvalue || skip_lastupdate || skip_fuffa || trim_newline || error!("Unexpected token") end def skip_lastupdate @input.skip(/>>>(.+?)<<<\n/) end def skip_fuffa @input.scan(/^\S(.+)\n/) end def skip_unless_keyvalue if !@input.match?(/(.+?):(.*?)\n/) @input.scan(/.*\n/) end end def parse_available if @input.scan(/^Not found: (.+)\n/) @ast["Domain Name"] = @input[1] @ast["status-available"] = true end end def parse_keyvalue if @input.scan(/(.+?):(.*?)\n/) key, value = @input[1].strip, @input[2].strip if @ast[key].nil? @ast[key] = value else @ast[key].is_a?(Array) || @ast[key] = [@ast[key]] @ast[key] << value end end end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems