Sha256: f452b05432e8b49baf0306eeb270634e46107f4112ff40bff50ebeb062acece1
Contents?: true
Size: 1.77 KB
Versions: 6
Compression:
Stored size: 1.77 KB
Contents
#!/usr/bin/env ruby -w ROOT = File.expand_path("../..", __FILE__) LIB = File.join(ROOT, "lib") $:.unshift(LIB) def pretty_state(state) case state when :supported then 'Y' when :not_supported then 'N' when :not_implemented then '.' end end def matrix(hosts) hosts.map do |host| klass = P.parser_klass(host) props = klass._properties PROPERTIES.inject([host]) { |all, property| all << pretty_state(props[property]) } end end def markdown_matrix(matrix, header: nil, formatter: ->(columns) { "| #{columns.join(" | ")} |" }) matrix = matrix.dup length = matrix.inject(0) { |l, row| l = row[0].size > l ? row[0].size : l } matrix.each { |row| row[0] = row[0].ljust(length) } output = matrix.map(&formatter) if header string = formatter.(header) output.unshift [string, string.gsub(/([^\|])/, "-")] end output.join("\n") end require 'whois' P = Whois::Record::Parser PROPERTIES = [:disclaimer, :domain, :domain_id, :status, :available?, :registered?, :created_on, :updated_on, :expires_on, :registrar, :registrant_contacts, :admin_contacts, :technical_contacts, :nameservers] hosts = Dir.glob(File.join(LIB, "whois/record/parser/*.rb")) .reject { |f| f.match?(/\/(base|blank|example)/) } .map { |f| File.basename(f, ".rb") } pthin = %w( whois.1und1.info whois.ascio.com whois.comlaude.com whois.dreamhost.com whois.enom.com whois.gandi.net whois.godaddy.com whois.markmonitor.com whois.networksolutions.com whois.pairnic.com whois.register.com whois.rrpproxy.net whois.schlund.info whois.tucows.com whois.udag.net whois.yoursrs.com ) ptlds = hosts - pthin puts markdown_matrix(matrix(ptlds), header: ["parser"] + PROPERTIES) puts markdown_matrix(matrix(pthin), header: ["parser"] + PROPERTIES)
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
whois-6.0.1 | utils/matrix.rb |
whois-6.0.0 | utils/matrix.rb |
whois-5.1.1 | utils/matrix.rb |
whois-5.1.0 | utils/matrix.rb |
whois-5.0.2 | utils/matrix.rb |
whois-5.0.1 | utils/matrix.rb |