4 attr_accessor :sendmail, :sig_file
7 super h[:name], h[:email]
8 @sendmail = h[:sendmail]
9 @sig_file = h[:signature]
16 attr_accessor :default_account
18 def initialize accounts
22 @default_account = nil
24 accounts.each { |k, v| add_account v, k == :default }
26 self.class.i_am_the_instance self
29 def user_accounts; @accounts.keys; end
30 def user_emails; (@email_map.keys + @alternate_map.keys).uniq.select { |e| String === e }; end
32 def add_account hash, default=false
35 next if @email_map.member? email
39 hash[:alternates].each { |aa| @alternate_map[aa] = a }
41 raise ArgumentError, "multiple default accounts" if @default_account
46 def is_account? p; @accounts.member? p; end
48 @email_map[email] || @alternate_map[email] || @alternate_map.argfind { |k, v| k === email && v }
50 def is_account_email? email; !account_for(email).nil?; end