Class: Yob

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

Defined Under Namespace

Modules: Database, Encrypt, Store Classes: Configuration

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Yob

Returns a new instance of Yob.



4
5
6
7
8
9
# File 'lib/yob.rb', line 4

def initialize(configuration)
  @configuration = configuration
  @store = @configuration.store_handler_class.new(@configuration)
  @database = @configuration.database_handler_class.new(@configuration)
  @encryption = @configuration.encryption_handler_class.new(@configuration)
end

Instance Method Details

#backup(type) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/yob.rb', line 11

def backup(type)
  @database.send(type) do |filename, rd|
    storage_pipe = @store.storage_input_pipe(filename)
    if rd
      @encryption.encrypt(rd, storage_pipe)
      storage_pipe.close
      nil
    else
      @encryption.encryption_input_pipe(storage_pipe)
    end
  end
  Process.waitall
end