Sha256: 7c6e419fa434371c5830083c37bf589800ae075ff41ef5fc8086462c6a5cdc9c

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module OrigenTesters::ATP
  module Processors
    # Adds the flow ID to all ids and label names
    class FlowID < Processor
      attr_reader :id

      def run(node, id)
        @id = id
        process(node)
      end

      def on_id(node)
        if node.value =~ /^extern/
          node
        else
          node.updated(nil, ["#{node.value}_#{id}"])
        end
      end

      def on_if_failed(node)
        tid, *nodes = *node
        if tid.is_a?(Array)
          tid = tid.map do |tid|
            if tid =~ /^extern/
              tid
            else
              "#{tid}_#{id}"
            end
          end
        else
          if tid !~ /^extern/
            tid = "#{tid}_#{id}"
          end
        end
        node.updated(nil, [tid] + process_all(nodes))
      end
      alias_method :on_if_any_failed, :on_if_failed
      alias_method :on_if_all_failed, :on_if_failed
      alias_method :on_if_passed, :on_if_failed
      alias_method :on_if_any_passed, :on_if_failed
      alias_method :on_if_all_passed, :on_if_failed
      alias_method :on_if_ran, :on_if_failed
      alias_method :on_unless_ran, :on_if_failed
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
origen_testers-0.40.0 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.31.0 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.30.0 lib/origen_testers/atp/processors/flow_id.rb