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.29 lib/ftw/dns/hash.rb
ftw-0.0.28 lib/ftw/dns/hash.rb
ftw-0.0.27 lib/ftw/dns/hash.rb
ftw-0.0.26 lib/ftw/dns/hash.rb
ftw-0.0.25 lib/ftw/dns/hash.rb
ftw-0.0.24 lib/ftw/dns/hash.rb
ftw-0.0.23 lib/ftw/dns/hash.rb
ftw-0.0.22 lib/ftw/dns/hash.rb
ftw-0.0.21 lib/ftw/dns/hash.rb
ftw-0.0.20 lib/ftw/dns/hash.rb
ftw-0.0.19 lib/ftw/dns/hash.rb
ftw-0.0.18 lib/ftw/dns/hash.rb
ftw-0.0.17 lib/ftw/dns/hash.rb
ftw-0.0.16 lib/ftw/dns/hash.rb
ftw-0.0.15 lib/ftw/dns/hash.rb
ftw-0.0.14 lib/ftw/dns/hash.rb
ftw-0.0.13 lib/ftw/dns/hash.rb
ftw-0.0.11 lib/ftw/dns/hash.rb
ftw-0.0.10 lib/ftw/dns/hash.rb
ftw-0.0.9 lib/ftw/dns/hash.rb