Sha256: 717efb21cb855ca5c743dc1672d7474b36042a46f6385ba9023703b634815fe8

Contents?: true

Size: 319 Bytes

Versions: 1

Compression:

Stored size: 319 Bytes

Contents

require "reversed/version"
require "net/dns"

module Reversed
  def self.lookup(ip)
    ip = ip.to_s
    unless ip.empty?
      resolver = Net::DNS::Resolver.new(retry: 3).search(ip)
      answer = resolver.answer.first || resolver.authority.first
      answer.value.split(" ").first[0..-2] if answer
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reversed-0.2.0 lib/reversed.rb