Class: OrigenTesters::ATP::Processors::Marshal

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

Overview

Makes the AST safe for Marshaling

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_object(node) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/origen_testers/atp/processors/marshal.rb', line 5

def on_object(node)
  o = node.value
  if o.is_a?(String)
    meta = { 'Test' => o }
  elsif o.is_a?(Hash)
    meta = o
  elsif o.respond_to?(:to_meta) && o.to_meta && !o.to_meta.empty?
    meta = o.to_meta
  else
    meta = {}
  end
  # The test suite / test instance name
  meta['Test'] ||= o.try(:name)
  meta['Pattern'] ||= o.try(:pattern)
  # The test name column on IG-XL, or the name of a specific instance of a test which shares a common
  # 'Test' name with other tests
  meta['Test Name'] ||= o.try(:test_name) || o.try(:_test_name) || o.try('TestName') || meta['Test']
  # The name of the primary test that is logged by the test instance / test method, if it logs more
  # than one then this is represented by sub_test nodes
  meta['Sub Test Name'] ||= o.try(:sub_test_name) || o.try('SubTestName') || meta['Test']
  node.updated(nil, [meta])
end

#on_render(node) ⇒ Object


28
29
30
# File 'lib/origen_testers/atp/processors/marshal.rb', line 28

def on_render(node)
  node.updated(nil, [node.value.to_s])
end