Class: MysqlS3Backup::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/mysql_s3_backup/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
# File 'lib/mysql_s3_backup/config.rb', line 7

def initialize(config)
  config = config.symbolize_keys
  @mysql_config = config[:mysql].symbolize_keys
  @s3_config = config[:s3].symbolize_keys
  @bucket = @s3_config.delete(:bucket)
  @timeout = @s3_config.delete(:timeout)
end

Instance Attribute Details

#bucketObject (readonly)

Returns the value of attribute bucket.



5
6
7
# File 'lib/mysql_s3_backup/config.rb', line 5

def bucket
  @bucket
end

#mysql_configObject (readonly)

Returns the value of attribute mysql_config.



5
6
7
# File 'lib/mysql_s3_backup/config.rb', line 5

def mysql_config
  @mysql_config
end

#s3_configObject (readonly)

Returns the value of attribute s3_config.



5
6
7
# File 'lib/mysql_s3_backup/config.rb', line 5

def s3_config
  @s3_config
end

Class Method Details

.from_yaml_file(file) ⇒ Object



27
28
29
# File 'lib/mysql_s3_backup/config.rb', line 27

def self.from_yaml_file(file)
  new YAML.load_file(file)
end

Instance Method Details

#backupObject



23
24
25
# File 'lib/mysql_s3_backup/config.rb', line 23

def backup
  MysqlS3Backup::Backup.new(mysql, bucket, @timeout)
end

#mysqlObject



15
16
17
# File 'lib/mysql_s3_backup/config.rb', line 15

def mysql
  MysqlS3Backup::Mysql.new(@mysql_config)
end