# File lib/new_relic/agent/rules_engine.rb, line 26
      def self.create_transaction_rules(connect_response)
        txn_name_specs     = connect_response['transaction_name_rules']    || []
        segment_rule_specs = connect_response['transaction_segment_terms'] || []

        txn_name_rules = txn_name_specs.map { |s| ReplacementRule.new(s) }

        segment_rules = []

        segment_rule_specs.each do |spec|
          if spec[SegmentTermsRule::PREFIX_KEY] && SegmentTermsRule.valid?(spec)
            # Build segment_rules in reverse order from which they're provided,
            # so that when we eliminate duplicates with #uniq!, we retain the last
            # instances of repeated rules.
            segment_rules.unshift SegmentTermsRule.new(spec)
          end
        end

        reject_rules_with_duplicate_prefixes!(segment_rules)

        segment_rules.reverse! # Reset the rules to their original order.

        self.new(txn_name_rules, segment_rules)
      end