Class: EasyBackup::Base

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

Instance Method Summary collapse

Constructor Details

#initialize(interval = EasyBackup.interval, &block) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
# File 'lib/easy_backup/base.rb', line 7

def initialize(interval=EasyBackup.interval, &block)
  @configurations = {}
  instance_eval &block
  @scheduler = Rufus::Scheduler.start_new frequency: interval
  schedule
end

Instance Method Details

#[](name) ⇒ Object



14
15
16
# File 'lib/easy_backup/base.rb', line 14

def [](name)
  @configurations[name]
end

#startObject



18
19
20
# File 'lib/easy_backup/base.rb', line 18

def start
  @scheduler.join
end