class FTW::DNS::Hash

Provide resolution name -> address mappings through hash lookups

Public Class Methods

new(data={}) click to toggle source

A new hash dns resolver.

@param [#[]] data Must be a hash-like thing responding to []

# File lib/ftw/dns/hash.rb, line 10
def initialize(data={})
  @data = data
end

Public Instance Methods

resolve(hostname) click to toggle source

Resolve a hostname.

It will return an array of all known addresses for the host.

# File lib/ftw/dns/hash.rb, line 17
def resolve(hostname)
  result = @data[hostname]
  return nil if result.nil?
  return result if result.is_a?(Array)
  return [result]
end