Sha256: 96e8e18bf6bc728cb385e651f48fb87f3ce11cb038ec87c86a25dc8adc32b1c2

Contents?: true

Size: 571 Bytes

Versions: 40

Compression:

Stored size: 571 Bytes

Contents

require "ftw/namespace"

# Provide resolution name -> address mappings through hash lookups
class FTW::DNS::Hash
  private

  # A new hash dns resolver.
  #
  # @param [#[]] data Must be a hash-like thing responding to #[]
  def initialize(data={})
    @data = data
  end # def initialize

  # Resolve a hostname.
  #
  # It will return an array of all known addresses for the host.
  def resolve(hostname)
    result = @data[hostname]
    return nil if result.nil?
    return result if result.is_a?(Array)
    return [result]
  end # def resolve

  public(:resolve)
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ftw-0.0.49 lib/ftw/dns/hash.rb
ftw-0.0.48 lib/ftw/dns/hash.rb
ftw-0.0.47 lib/ftw/dns/hash.rb
ftw-0.0.46 lib/ftw/dns/hash.rb
ftw-0.0.45 lib/ftw/dns/hash.rb
ftw-0.0.44 lib/ftw/dns/hash.rb
ftw-0.0.43 lib/ftw/dns/hash.rb
ftw-0.0.42 lib/ftw/dns/hash.rb
ftw-0.0.41 lib/ftw/dns/hash.rb
ftw-0.0.40 lib/ftw/dns/hash.rb
ftw-0.0.39 lib/ftw/dns/hash.rb
ftw-0.0.38 lib/ftw/dns/hash.rb
ftw-0.0.37 lib/ftw/dns/hash.rb
ftw-0.0.36 lib/ftw/dns/hash.rb
ftw-0.0.35 lib/ftw/dns/hash.rb
ftw-0.0.34 lib/ftw/dns/hash.rb
ftw-0.0.33 lib/ftw/dns/hash.rb
ftw-0.0.32 lib/ftw/dns/hash.rb
ftw-0.0.31 lib/ftw/dns/hash.rb
ftw-0.0.30 lib/ftw/dns/hash.rb