Class: CloudBackup::DriverStack

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDriverStack

Returns a new instance of DriverStack.



7
8
9
10
11
# File 'lib/driver_stack.rb', line 7

def initialize
  @list = []
  @max_items = 2
  @file_names = []
end

Instance Attribute Details

#max_itemsObject

Returns the value of attribute max_items.



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

def max_items
  @max_items
end

Instance Method Details

#add_driver(konstant) ⇒ Object



21
22
23
# File 'lib/driver_stack.rb', line 21

def add_driver konstant
  @list << konstant
end

#add_file(name) ⇒ Object



25
26
27
# File 'lib/driver_stack.rb', line 25

def add_file name
  @file_names << name
end

#add_files(array) ⇒ Object



29
30
31
# File 'lib/driver_stack.rb', line 29

def add_files array
  @file_names = @file_names + array
end

#addable?(driver) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/driver_stack.rb', line 17

def addable? driver
  driver.is_a? CloudBackup::Driver
end

#driver_initiateObject



41
42
43
44
45
# File 'lib/driver_stack.rb', line 41

def driver_initiate
  @list.each do |driver|
    driver.initiate
  end
end

#listObject



13
14
15
# File 'lib/driver_stack.rb', line 13

def list
  @list
end

#perform_backup!Object



33
34
35
36
37
38
39
# File 'lib/driver_stack.rb', line 33

def perform_backup!
  driver_initiate
  driver_add_files
  driver_upload_files
  driver_remove_old_files
  driver_shut_down_execution
end