Class: DatedBackup::ExecutionContext::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/dated_backup/dsl/execution_context.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.main_instanceObject (readonly) Also known as: core_instance, instance

Returns the value of attribute main_instance.



43
44
45
# File 'lib/dated_backup/dsl/execution_context.rb', line 43

def main_instance
  @main_instance
end

Class Method Details

.__anonymous_classObject



19
20
21
22
23
# File 'lib/dated_backup/dsl/execution_context.rb', line 19

def __anonymous_class
  Class.new do
    include DSL::Main
  end
end

.__instance_eval_file_in_new_anonymous_class(filename) ⇒ Object



29
30
31
32
33
# File 'lib/dated_backup/dsl/execution_context.rb', line 29

def __instance_eval_file_in_new_anonymous_class(filename)
  instance = __new_anonymous_class_instance
  instance.instance_eval(File.read(filename))
  instance
end

.__new_anonymous_class_instanceObject



25
26
27
# File 'lib/dated_backup/dsl/execution_context.rb', line 25

def __new_anonymous_class_instance
  __anonymous_class.new
end

.load(filename) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/dated_backup/dsl/execution_context.rb', line 35

def load(filename)
  instance = __instance_eval_file_in_new_anonymous_class(filename)
  
  @main_instance = DatedBackup::Core.new(instance.procs)
  @main_instance.set_attributes(instance.hash)
  @main_instance.run
end