class RSwim::Directory

Public Class Methods

new() click to toggle source
# File lib/rswim/directory.rb, line 5
def initialize
  @i = 0
  @ids = {}
  @hosts = {}
end

Public Instance Methods

host(id) click to toggle source
# File lib/rswim/directory.rb, line 23
def host(id)
  @hosts[id]
end
id(host) click to toggle source
# File lib/rswim/directory.rb, line 11
def id(host)
  result = @ids[host]
  if result.nil?
    @i += 1
    @ids[host] = @i
    @hosts[@i] = host
    @i
  else
    result
  end
end