Class: Backup::Configuration::Base

Inherits:
Object
  • Object
show all
Extended by:
Attribute
Defined in:
lib/backup/configuration/base.rb

Instance Method Summary collapse

Methods included from Attribute

generate_attributes

Instance Method Details

#check(name = nil, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/backup/configuration/base.rb', line 32

def check(name=nil,&block)
  @check ||= {}

  if block
    name ||= "check_#{@check.keys.size}"
    @check[name] = Backup::Configuration::Check.new 
    @check[name].instance_eval &block
  end

  @check
end

#server(name = nil, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/backup/configuration/base.rb', line 20

def server(name=nil,&block)
  @servers  ||= {}

  if block
    name ||= "server_#{@servers.keys.size}"
    @servers[name] = Backup::Configuration::Server.new
    @servers[name].instance_eval &block
  end

  @servers
end

#storage(name = nil, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/backup/configuration/base.rb', line 8

def storage(name=nil,&block)
  @storages ||= {}

  if block
    name ||= "storage_#{@storages.keys.size}"
    @storages[name] = Backup::Configuration::Storage.new
    @storages[name].instance_eval &block
  end

  @storages
end