Sha256: 4d01544e2fc65b375a45ec32459d3eb6da931cb4e47ad8735592384783ec88ea

Contents?: true

Size: 1.36 KB

Versions: 37

Compression:

Stored size: 1.36 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
      alias_method :on_if_any_sites_failed, :on_if_failed
      alias_method :on_if_all_sites_failed, :on_if_failed
      alias_method :on_if_any_sites_passed, :on_if_failed
      alias_method :on_if_all_sites_passed, :on_if_failed
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
origen_testers-0.52.8 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.7 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.6 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.5 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.4 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.3 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.1 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.52.0 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.5 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.4 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.3 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.2 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.1 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.51.0 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.50.0 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.49.4 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.49.3 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.49.2 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.49.1 lib/origen_testers/atp/processors/flow_id.rb
origen_testers-0.49.0 lib/origen_testers/atp/processors/flow_id.rb