Class: Tumugi::Application
- Inherits:
-
Object
- Object
- Tumugi::Application
- Defined in:
- lib/tumugi/application.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #add_task(id, task) ⇒ Object
- #execute(command, root_task_id, options) ⇒ Object
- #find_task(id) ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
13 14 15 16 |
# File 'lib/tumugi/application.rb', line 13 def initialize @tasks = {} @params = {} end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
11 12 13 |
# File 'lib/tumugi/application.rb', line 11 def params @params end |
Instance Method Details
#add_task(id, task) ⇒ Object
27 28 29 |
# File 'lib/tumugi/application.rb', line 27 def add_task(id, task) @tasks[id.to_s] = task end |
#execute(command, root_task_id, options) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/tumugi/application.rb', line 18 def execute(command, root_task_id, ) () load_workflow_file([:file]) dag = create_dag(root_task_id) command_module = Kernel.const_get("Tumugi").const_get("Command") cmd = command_module.const_get("#{command.to_s.capitalize}").new cmd.execute(dag, ) end |
#find_task(id) ⇒ Object
31 32 33 34 35 |
# File 'lib/tumugi/application.rb', line 31 def find_task(id) task = @tasks[id.to_s] raise Tumugi::TumugiError, "Task not found: #{id}" if task.nil? task end |