Class: DSLTasks::DSLTaskContext
- Inherits:
-
Object
- Object
- DSLTasks::DSLTaskContext
- Includes:
- TaskMixin
- Defined in:
- lib/dsltasks/dsltasks.rb
Instance Attribute Summary
Attributes included from TaskMixin
#__block__, #__lib_dirs__, #__lib_stack__, #__name__, #__parent_task__
Instance Method Summary collapse
- #execute(main, libs) ⇒ Object
-
#initialize(base_file, lib_dirs = nil) ⇒ DSLTaskContext
constructor
A new instance of DSLTaskContext.
Methods included from TaskMixin
#__caller__, #__exec__, #__initialize_task_mixin__, #lib, #method_missing, #respond_to_missing?, #run_task, #task
Constructor Details
#initialize(base_file, lib_dirs = nil) ⇒ DSLTaskContext
Returns a new instance of DSLTaskContext.
111 112 113 114 |
# File 'lib/dsltasks/dsltasks.rb', line 111 def initialize(base_file, lib_dirs=nil) @__task_context__ = Hash.new __initialize_task_mixin__(lib_stack: [base_file], lib_dirs: lib_dirs) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class DSLTasks::TaskMixin
Instance Method Details
#execute(main, libs) ⇒ Object
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/dsltasks/dsltasks.rb', line 116 def execute(main, libs) __lib_stack__.push(main) (libs || []).each do |l| lib l end __lib_stack__.pop instance_eval(File.read(main), main) end |