Instead of interrupting task evaluation when condition is not met, allow the whole task to be evaluated (including condition and evaluation) so that the interpreter will get all tasks actions (whether condition is met or not) and be able to query the condition. * Modify Interpreter#process_task: test if task condition is met before applying the actions; * Implement condition handling in Task and Task::DSL; * Implement Condition and Condition::DSL (useless as they are, but needed to implement later test keywords as part of the condition DSL.
14 lines
245 B
Ruby
14 lines
245 B
Ruby
module Producer
|
|
module Core
|
|
class Interpreter
|
|
def process(tasks)
|
|
tasks.each { |t| process_task t }
|
|
end
|
|
|
|
def process_task(task)
|
|
task.actions.each(&:apply) if task.condition_met?
|
|
end
|
|
end
|
|
end
|
|
end
|