# File lib/sup/contact.rb, line 6 def initialize fn @fn = fn ## maintain the mapping between people and aliases. for contacts without ## aliases, there will be no @a2p entry, so @p2a.keys should be treated ## as the canonical list of contacts. @p2a = {} # person to alias @a2p = {} # alias to person if File.exists? fn IO.foreach(fn) do |l| l =~ /^([^:]*): (.*)$/ or raise "can't parse #{fn} line #{l.inspect}" aalias, addr = $1, $2 p = Person.from_address addr @p2a[p] = aalias @a2p[aalias] = p unless aalias.nil? || aalias.empty? end end end
# File lib/sup/contact.rb, line 47 def alias_for person; @p2a[person] end
# File lib/sup/contact.rb, line 46 def contact_for aalias; @a2p[aalias] end
# File lib/sup/contact.rb, line 28 def contacts_with_aliases; @a2p.values.uniq end
this may not actually be called anywhere, since we still keep contacts around without aliases to override any fullname changes.
# File lib/sup/contact.rb, line 40 def drop_contact person aalias = @p2a[person] @p2a.delete person @a2p.delete aalias if aalias end
# File lib/sup/contact.rb, line 48 def is_aliased_contact? person; !@p2a[person].nil? end
Generated with the Darkfish Rdoc Generator 2.