Class: Backup::Tasks::MySQL::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/backup-agent/tasks/mysql.rb

Instance Method Summary collapse

Constructor Details

#initialize(user:, password:) ⇒ Credentials

Returns a new instance of Credentials.



66
67
68
69
# File 'lib/backup-agent/tasks/mysql.rb', line 66

def initialize(user:, password:)
  @user     = user
  @password = password
end

Instance Method Details

#stringifyObject



71
72
73
# File 'lib/backup-agent/tasks/mysql.rb', line 71

def stringify
  "--user #{@user} #{stringify_password}"
end

#stringify_passwordObject



75
76
77
# File 'lib/backup-agent/tasks/mysql.rb', line 75

def stringify_password
  @password.nil? || @password.empty? ? "" : "--password=#{@password}"
end

#to_optionsObject



79
80
81
# File 'lib/backup-agent/tasks/mysql.rb', line 79

def to_options
  ["--user", @user, stringify_password]
end