Class: Imap::Backup::Setup::Email
- Inherits:
-
Object
- Object
- Imap::Backup::Setup::Email
- Defined in:
- lib/imap/backup/setup/email.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(account:, config:) ⇒ Email
constructor
A new instance of Email.
- #run ⇒ Object
Constructor Details
#initialize(account:, config:) ⇒ Email
Returns a new instance of Email.
12 13 14 15 |
# File 'lib/imap/backup/setup/email.rb', line 12 def initialize(account:, config:) @account = account @config = config end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
9 10 11 |
# File 'lib/imap/backup/setup/email.rb', line 9 def account @account end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/imap/backup/setup/email.rb', line 10 def config @config end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/imap/backup/setup/email.rb', line 17 def run username = Setup::Asker.email(account.username) other_accounts = config.accounts.reject { |a| a == account } others = other_accounts.map(&:username) if others.include?(username) Kernel.puts( "There is already an account set up with that email address" ) else account.username = username if account.server.nil? || (account.server == "") default = default_server(username) account.server = default if default end end end |