Module: Imap::Backup::CLI::Helpers
- Defined in:
- lib/imap/backup/cli/helpers.rb
Instance Method Summary collapse
- #account(email) ⇒ Object
- #connection(email) ⇒ Object
- #each_connection(names) ⇒ Object
- #symbolized(options) ⇒ Object
Instance Method Details
#account(email) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/imap/backup/cli/helpers.rb', line 9 def account(email) accounts = Imap::Backup::CLI::Accounts.new account = accounts.find { |a| a.username == email } raise "#{email} is not a configured account" if !account account end |
#connection(email) ⇒ Object
17 18 19 20 21 |
# File 'lib/imap/backup/cli/helpers.rb', line 17 def connection(email) account = account(email) Imap::Backup::Account::Connection.new(account) end |
#each_connection(names) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/imap/backup/cli/helpers.rb', line 23 def each_connection(names) accounts = Imap::Backup::CLI::Accounts.new(names) accounts.each do |account| yield account.connection end rescue Imap::Backup::ConfigurationNotFound raise "imap-backup is not configured. Run `imap-backup setup`" end |
#symbolized(options) ⇒ Object
5 6 7 |
# File 'lib/imap/backup/cli/helpers.rb', line 5 def symbolized() .each.with_object({}) { |(k, v), acc| acc[k.intern] = v } end |