Sha256: 68cff64ae0cb13eabdfd0c9e51fd5a6fbdfb5e356cd36d3a8555b41ddaa6091e

Contents?: true

Size: 863 Bytes

Versions: 12

Compression:

Stored size: 863 Bytes

Contents

module 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_test_result(node)
        tid, state, 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, state] + [process(nodes)])
      end
      alias_method :on_test_executed, :on_test_result
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
atp-0.8.0 lib/atp/processors/flow_id.rb
atp-0.7.0 lib/atp/processors/flow_id.rb
atp-0.6.0 lib/atp/processors/flow_id.rb
atp-0.5.4 lib/atp/processors/flow_id.rb
atp-0.5.3 lib/atp/processors/flow_id.rb
atp-0.5.0 lib/atp/processors/flow_id.rb
atp-0.4.3 lib/atp/processors/flow_id.rb
atp-0.4.2 lib/atp/processors/flow_id.rb
atp-0.4.1 lib/atp/processors/flow_id.rb
atp-0.4.0 lib/atp/processors/flow_id.rb
atp-0.3.3 lib/atp/processors/flow_id.rb
atp-0.3.2 lib/atp/processors/flow_id.rb