Class: DatedBackup::ExecutionContext::Main
- Inherits:
-
Object
- Object
- DatedBackup::ExecutionContext::Main
- Defined in:
- lib/dated_backup/dsl/execution_context.rb
Class Attribute Summary collapse
-
.main_instance ⇒ Object
(also: core_instance, instance)
readonly
Returns the value of attribute main_instance.
Class Method Summary collapse
- .__anonymous_class ⇒ Object
- .__instance_eval_file_in_new_anonymous_class(filename) ⇒ Object
- .__new_anonymous_class_instance ⇒ Object
- .load(filename) ⇒ Object
Class Attribute Details
.main_instance ⇒ Object (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_class ⇒ Object
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_instance ⇒ Object
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 |