Class: OrigenTesters::ATP::Processors::EmptyBranchRemover

Inherits:
OrigenTesters::ATP::Processor show all
Defined in:
lib/origen_testers/atp/processors/empty_branch_remover.rb

Overview

Removes any empty on_pass and on_fail branches

Instance Method Summary collapse

Methods inherited from OrigenTesters::ATP::Processor

#clean_flag, #extract_volatiles, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags

Instance Method Details

#on_test(node) ⇒ Object

Delete any on-fail child if it’s ‘empty’



6
7
8
9
10
11
12
13
14
# File 'lib/origen_testers/atp/processors/empty_branch_remover.rb', line 6

def on_test(node)
  if on_pass = node.find(:on_pass)
    node = node.remove(on_pass) if on_pass.children.empty?
  end
  if on_fail = node.find(:on_fail)
    node = node.remove(on_fail) if on_fail.children.empty?
  end
  node = node.updated(nil, process_all(node.children))
end