Class: YOLOBackup::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/yolo_backup/server.rb

Constant Summary collapse

OPTIONS =
%w{ excludes rotation ssh_host ssh_key ssh_port ssh_user storage }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Server

Returns a new instance of Server.



11
12
13
14
15
16
# File 'lib/yolo_backup/server.rb', line 11

def initialize(name, options)
  @name = name
  OPTIONS.each do |option|
    send("#{option}=", options[option]) if options.key?(option)
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/yolo_backup/server.rb', line 9

def name
  @name
end

Instance Method Details

#cleanup_backupsObject



22
23
24
# File 'lib/yolo_backup/server.rb', line 22

def cleanup_backups
  storage.cleanup(self)
end

#latest_backupObject



18
19
20
# File 'lib/yolo_backup/server.rb', line 18

def latest_backup
  storage.latest_backup(self)
end

#to_sObject



26
27
28
# File 'lib/yolo_backup/server.rb', line 26

def to_s
  name
end